Commit | Line | Data |
---|---|---|
e8d771d5 BH |
1 | /******************************************************************************* |
2 | * Copyright (c) 2011 Ericsson | |
3 | * | |
4 | * All rights reserved. This program and the accompanying materials are | |
5 | * made available under the terms of the Eclipse Public License v1.0 which | |
6 | * accompanies this distribution, and is available at | |
7 | * http://www.eclipse.org/legal/epl-v10.html | |
8 | * | |
9 | * Contributors: | |
10 | * Polytechnique Montréal - Initial API and implementation | |
11 | * Bernd Hufmann - Productification, enhancements and fixes | |
12 | * | |
13 | *******************************************************************************/ | |
14 | package org.eclipse.linuxtools.lttng.tracecontrol.model.config; | |
15 | ||
16 | import org.eclipse.linuxtools.lttng.tracecontrol.model.config.TraceChannels; | |
17 | ||
18 | /** | |
19 | * <b><u>TraceChannel</u></b> | |
20 | * <p> | |
21 | * This models a trace representing a trace resource for a particular remote system. | |
22 | * </p> | |
23 | */ | |
24 | public class TraceConfig { | |
25 | ||
26 | // ------------------------------------------------------------------------ | |
27 | // Constants | |
28 | // ------------------------------------------------------------------------ | |
29 | public static final int NONE_MODE = 0; | |
30 | public static final int FLIGHT_RECORDER_MODE = 1; | |
31 | public static final int NORMAL_MODE = 2; | |
32 | ||
33 | public static final String InvalidTracePath = "network"; //$NON-NLS-1$ | |
34 | ||
35 | // ------------------------------------------------------------------------ | |
36 | // Attributes | |
37 | // ------------------------------------------------------------------------ | |
38 | ||
39 | private String fTraceName = null; | |
40 | private String fTraceTransport = null; | |
41 | private String fTracePath = null; | |
42 | private boolean fIsNetworkTrace = false; | |
43 | private boolean fIsAppend = false; | |
44 | private int fMode = 0; | |
45 | private int fNumChannel = 0; | |
46 | private TraceChannels fChannels = null; | |
47 | ||
48 | // ------------------------------------------------------------------------ | |
49 | // Constructors | |
50 | // ------------------------------------------------------------------------ | |
51 | public TraceConfig() { | |
52 | } | |
53 | ||
54 | // ------------------------------------------------------------------------ | |
55 | // Operations | |
56 | // ------------------------------------------------------------------------ | |
57 | ||
58 | /** | |
59 | * Gets the number of threads | |
60 | * | |
61 | * @return number of threads | |
62 | */ | |
63 | public int getNumChannel() { | |
64 | return fNumChannel; | |
65 | } | |
66 | ||
67 | /** | |
68 | * Sets the number of threads (channels) | |
69 | * @param numChannel | |
70 | */ | |
71 | public void setNumChannel(int numChannel) { | |
72 | fNumChannel = numChannel; | |
73 | } | |
74 | ||
75 | /** | |
76 | * Gets the trace name. | |
77 | * | |
78 | * @return trace name | |
79 | */ | |
80 | public String getTraceName() { | |
81 | return fTraceName; | |
82 | } | |
83 | ||
84 | /** | |
85 | * Sets the trace name. | |
86 | * | |
87 | * @param traceName | |
88 | */ | |
89 | public void setTraceName(String traceName) { | |
90 | fTraceName = traceName; | |
91 | } | |
92 | ||
93 | /** | |
94 | * Gets the trace transport. | |
95 | * | |
96 | * @return trace transport | |
97 | */ | |
98 | public String getTraceTransport() { | |
99 | return fTraceTransport; | |
100 | } | |
101 | ||
102 | /** | |
103 | * Sets the trace transport. | |
104 | * | |
105 | * @param traceTransport | |
106 | */ | |
107 | public void setTraceTransport(String traceTransport) { | |
108 | fTraceTransport = traceTransport; | |
109 | } | |
110 | ||
111 | /** | |
112 | * Returns wether trace is a network trace (i.e. trace will be stored | |
113 | * on local host where client resides) or a local trace (i.e. trace will | |
114 | * be stored on same machine where the actual trace is collected) | |
115 | * | |
116 | * @return isNetworktrace | |
117 | */ | |
118 | public boolean isNetworkTrace() { | |
119 | return fIsNetworkTrace; | |
120 | } | |
121 | ||
122 | /** | |
123 | * Sets whether trace is a network trace (i.e. trace will be stored | |
124 | * on local host where client resides) or a local trace (i.e. trace will | |
125 | * be stored on same machine where the actual trace is collected) | |
126 | * | |
127 | * @param isNetworkTrace | |
128 | */ | |
129 | public void setNetworkTrace(boolean isNetworkTrace) { | |
130 | fIsNetworkTrace = isNetworkTrace; | |
131 | } | |
132 | ||
133 | /** | |
134 | * Returns whether trace should append an existing trace or not. | |
135 | * | |
136 | * @return true if append else false | |
137 | */ | |
138 | public boolean getIsAppend() { | |
139 | return fIsAppend; | |
140 | } | |
141 | ||
142 | /** | |
143 | * Sets whether trace should append an existing trace or not. | |
144 | * | |
145 | * @param isAppend | |
146 | */ | |
147 | public void setIsAppend(boolean isAppend) { | |
148 | fIsAppend = isAppend; | |
149 | } | |
150 | ||
151 | /** | |
152 | * Gets the trace mode. | |
153 | * | |
154 | * @return trace mode | |
155 | */ | |
156 | public int getMode() { | |
157 | return fMode; | |
158 | } | |
159 | ||
160 | /** | |
161 | * Sets the trace mode. | |
162 | * | |
163 | * @param mode | |
164 | */ | |
165 | public void setMode(int mode) { | |
166 | fMode = mode; | |
167 | } | |
168 | ||
169 | /** | |
170 | * Gets the path where trace will be stored. | |
171 | * | |
172 | * @return trace path | |
173 | */ | |
174 | public String getTracePath() { | |
175 | return fTracePath; | |
176 | } | |
177 | ||
178 | /** | |
179 | * Sets the path where trace will be stored. | |
180 | * | |
181 | * @param path | |
182 | */ | |
183 | public void setTracePath(String path) { | |
184 | fTracePath = path; | |
185 | } | |
186 | ||
187 | /** | |
188 | * Gets the trace channels collection. | |
189 | * | |
190 | * @return trace channels | |
191 | */ | |
192 | public TraceChannels getTraceChannels() { | |
193 | return fChannels; | |
194 | } | |
195 | ||
196 | /** | |
197 | * Sets the trace channels collection. | |
198 | * | |
199 | * @param channels | |
200 | */ | |
201 | public void setTraceChannels(TraceChannels channels) { | |
202 | fChannels = channels; | |
203 | } | |
204 | ||
205 | /** | |
206 | * Sets the trace channels collection with given names | |
207 | * and creates default trace channels. | |
208 | * | |
209 | * @param channels | |
210 | */ | |
211 | public void setTraceChannels(String[] channels) { | |
212 | fChannels = new TraceChannels(); | |
213 | fChannels.putAll(channels); | |
214 | } | |
215 | } |