summaryrefslogtreecommitdiff
path: root/src/com/android/loganalysis/item/BugreportItem.java
blob: e7167289273bb194b39808e51a62983a9e6ddb45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
/*
 * Copyright (C) 2012 The Android Open Source Project
 *
 * Licensed 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
 *
 *      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.
 */
package com.android.loganalysis.item;

import java.util.Arrays;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

/**
 * An {@link IItem} used to store Bugreport info.
 */
public class BugreportItem extends GenericItem {

    /** Constant for JSON output */
    public static final String TIME = "TIME";
    /** Constant for JSON output */
    public static final String COMMAND_LINE = "COMMAND_LINE";
    /** Constant for JSON output */
    public static final String MEM_INFO = "MEM_INFO";
    /** Constant for JSON output */
    public static final String PROCRANK = "PROCRANK";
    /** Constant for JSON output */
    public static final String TOP = "TOP";
    /** Constant for JSON output */
    public static final String KERNEL_LOG = "KERNEL_LOG";
    /** Constant for JSON output */
    public static final String LAST_KMSG = "LAST_KMSG";
    /** Constant for JSON output */
    public static final String SYSTEM_LOG = "SYSTEM_LOG";
    /** Constant for JSON output */
    public static final String SYSTEM_PROPS = "SYSTEM_PROPS";
    /** Constant for JSON output */
    public static final String DUMPSYS = "DUMPSYS";
    /** Constant for JSON output */
    public static final String ACTIVITY_SERVICE = "ACTIVITY_SERVICE";

    private static final Set<String> ATTRIBUTES = new HashSet<String>(Arrays.asList(
            TIME, COMMAND_LINE, MEM_INFO, PROCRANK, TOP, KERNEL_LOG, LAST_KMSG, SYSTEM_LOG,
            SYSTEM_PROPS, DUMPSYS, ACTIVITY_SERVICE));

    public static class CommandLineItem extends GenericMapItem<String> {
        private static final long serialVersionUID = 0L;
    }

    /**
     * The constructor for {@link BugreportItem}.
     */
    public BugreportItem() {
        super(ATTRIBUTES);
    }

    /**
     * Get the time of the bugreport.
     */
    public Date getTime() {
        return (Date) getAttribute(TIME);
    }

    /**
     * Set the time of the bugreport.
     */
    public void setTime(Date time) {
        setAttribute(TIME, time);
    }

    /**
     * Get the {@link CommandLineItem} of the bugreport.
     */
    public CommandLineItem getCommandLine() {
        return (CommandLineItem) getAttribute(COMMAND_LINE);
    }

    /**
     * Set the {@link CommandLineItem} of the bugreport.
     */
    public void setCommandLine(CommandLineItem commandLine) {
        setAttribute(COMMAND_LINE, commandLine);
    }

    /**
     * Get the {@link MemInfoItem} of the bugreport.
     */
    public MemInfoItem getMemInfo() {
        return (MemInfoItem) getAttribute(MEM_INFO);
    }

    /**
     * Set the {@link MemInfoItem} of the bugreport.
     */
    public void setMemInfo(MemInfoItem memInfo) {
        setAttribute(MEM_INFO, memInfo);
    }

    /**
     * Get the {@link ProcrankItem} of the bugreport.
     */
    public ProcrankItem getProcrank() {
        return (ProcrankItem) getAttribute(PROCRANK);
    }

    /**
     * Set the {@link ProcrankItem} of the bugreport.
     */
    public void setProcrank(ProcrankItem procrank) {
        setAttribute(PROCRANK, procrank);
    }

    /**
     * Get the {@link TopItem} of the bugreport.
     */
    public TopItem getTop() {
        return (TopItem) getAttribute(TOP);
    }

    /**
     * Set the {@link TopItem} of the bugreport.
     */
    public void setTop(TopItem top) {
        setAttribute(TOP, top);
    }

    /**
     * Get the kernel log {@link KernelLogItem} of the bugreport.
     */
    public KernelLogItem getKernelLog() {
        return (KernelLogItem) getAttribute(KERNEL_LOG);
    }

    /**
     * Set the kernel log {@link KernelLogItem} of the bugreport.
     */
    public void setKernelLog(KernelLogItem systemLog) {
        setAttribute(KERNEL_LOG, systemLog);
    }

    /**
     * Get the last kmsg {@link KernelLogItem} of the bugreport.
     */
    public KernelLogItem getLastKmsg() {
        return (KernelLogItem) getAttribute(LAST_KMSG);
    }

    /**
     * Set the last kmsg {@link KernelLogItem} of the bugreport.
     */
    public void setLastKmsg(KernelLogItem systemLog) {
        setAttribute(LAST_KMSG, systemLog);
    }

    /**
     * Get the {@link LogcatItem} of the bugreport.
     */
    public LogcatItem getSystemLog() {
        return (LogcatItem) getAttribute(SYSTEM_LOG);
    }

    /**
     * Set the {@link LogcatItem} of the bugreport.
     */
    public void setSystemLog(LogcatItem systemLog) {
        setAttribute(SYSTEM_LOG, systemLog);
    }

    /**
     * Get the {@link SystemPropsItem} of the bugreport.
     */
    public SystemPropsItem getSystemProps() {
        return (SystemPropsItem) getAttribute(SYSTEM_PROPS);
    }

    /**
     * Set the {@link SystemPropsItem} of the bugreport.
     */
    public void setSystemProps(SystemPropsItem systemProps) {
        setAttribute(SYSTEM_PROPS, systemProps);
    }

    /**
     * Get the {@link DumpsysItem} of the bugreport.
     */
    public DumpsysItem getDumpsys() {
        return (DumpsysItem) getAttribute(DUMPSYS);
    }

    /**
     * Set the {@link DumpsysItem} of the bugreport.
     */
    public void setDumpsys(DumpsysItem dumpsys) {
        setAttribute(DUMPSYS, dumpsys);
    }
    /**
     * Get the {@link ActivityServiceItem} of the bugreport.
     */
    public ActivityServiceItem getActivityService() {
        return (ActivityServiceItem) getAttribute(ACTIVITY_SERVICE);
    }

    /**
     * Set the {@link ActivityServiceItem} of the bugreport.
     */
    public void setActivityService(ActivityServiceItem activityService) {
        setAttribute(ACTIVITY_SERVICE, activityService);
    }
}