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 | *******************************************************************************/ | |
5945cec9 | 14 | package org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.config; |
e8d771d5 | 15 | |
a79913eb FC |
16 | import org.eclipse.core.resources.IProject; |
17 | ||
e8d771d5 BH |
18 | |
19 | /** | |
20 | * <b><u>TraceChannel</u></b> | |
21 | * <p> | |
22 | * This models a trace representing a trace resource for a particular remote system. | |
23 | * </p> | |
24 | */ | |
25 | public class TraceConfig { | |
26 | ||
27 | // ------------------------------------------------------------------------ | |
28 | // Constants | |
29 | // ------------------------------------------------------------------------ | |
a79913eb | 30 | public static final int NORMAL_MODE = 0; |
e8d771d5 | 31 | public static final int FLIGHT_RECORDER_MODE = 1; |
e8d771d5 BH |
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; | |
a79913eb | 47 | private IProject fProject = null; |
e8d771d5 BH |
48 | |
49 | // ------------------------------------------------------------------------ | |
50 | // Constructors | |
51 | // ------------------------------------------------------------------------ | |
52 | public TraceConfig() { | |
53 | } | |
54 | ||
55 | // ------------------------------------------------------------------------ | |
56 | // Operations | |
57 | // ------------------------------------------------------------------------ | |
58 | ||
59 | /** | |
60 | * Gets the number of threads | |
61 | * | |
62 | * @return number of threads | |
63 | */ | |
64 | public int getNumChannel() { | |
65 | return fNumChannel; | |
66 | } | |
67 | ||
68 | /** | |
69 | * Sets the number of threads (channels) | |
70 | * @param numChannel | |
71 | */ | |
72 | public void setNumChannel(int numChannel) { | |
73 | fNumChannel = numChannel; | |
74 | } | |
75 | ||
76 | /** | |
77 | * Gets the trace name. | |
78 | * | |
79 | * @return trace name | |
80 | */ | |
81 | public String getTraceName() { | |
82 | return fTraceName; | |
83 | } | |
84 | ||
85 | /** | |
86 | * Sets the trace name. | |
87 | * | |
88 | * @param traceName | |
89 | */ | |
90 | public void setTraceName(String traceName) { | |
91 | fTraceName = traceName; | |
92 | } | |
93 | ||
94 | /** | |
95 | * Gets the trace transport. | |
96 | * | |
97 | * @return trace transport | |
98 | */ | |
99 | public String getTraceTransport() { | |
100 | return fTraceTransport; | |
101 | } | |
102 | ||
103 | /** | |
104 | * Sets the trace transport. | |
105 | * | |
106 | * @param traceTransport | |
107 | */ | |
108 | public void setTraceTransport(String traceTransport) { | |
109 | fTraceTransport = traceTransport; | |
110 | } | |
111 | ||
112 | /** | |
113 | * Returns wether trace is a network trace (i.e. trace will be stored | |
114 | * on local host where client resides) or a local trace (i.e. trace will | |
115 | * be stored on same machine where the actual trace is collected) | |
116 | * | |
117 | * @return isNetworktrace | |
118 | */ | |
119 | public boolean isNetworkTrace() { | |
120 | return fIsNetworkTrace; | |
121 | } | |
122 | ||
123 | /** | |
124 | * Sets whether trace is a network trace (i.e. trace will be stored | |
125 | * on local host where client resides) or a local trace (i.e. trace will | |
126 | * be stored on same machine where the actual trace is collected) | |
127 | * | |
128 | * @param isNetworkTrace | |
129 | */ | |
130 | public void setNetworkTrace(boolean isNetworkTrace) { | |
131 | fIsNetworkTrace = isNetworkTrace; | |
132 | } | |
133 | ||
134 | /** | |
135 | * Returns whether trace should append an existing trace or not. | |
136 | * | |
137 | * @return true if append else false | |
138 | */ | |
139 | public boolean getIsAppend() { | |
140 | return fIsAppend; | |
141 | } | |
142 | ||
143 | /** | |
144 | * Sets whether trace should append an existing trace or not. | |
145 | * | |
146 | * @param isAppend | |
147 | */ | |
148 | public void setIsAppend(boolean isAppend) { | |
149 | fIsAppend = isAppend; | |
150 | } | |
151 | ||
152 | /** | |
153 | * Gets the trace mode. | |
154 | * | |
155 | * @return trace mode | |
156 | */ | |
157 | public int getMode() { | |
158 | return fMode; | |
159 | } | |
160 | ||
161 | /** | |
162 | * Sets the trace mode. | |
163 | * | |
164 | * @param mode | |
165 | */ | |
166 | public void setMode(int mode) { | |
167 | fMode = mode; | |
168 | } | |
169 | ||
170 | /** | |
171 | * Gets the path where trace will be stored. | |
172 | * | |
173 | * @return trace path | |
174 | */ | |
175 | public String getTracePath() { | |
176 | return fTracePath; | |
177 | } | |
178 | ||
179 | /** | |
180 | * Sets the path where trace will be stored. | |
181 | * | |
182 | * @param path | |
183 | */ | |
184 | public void setTracePath(String path) { | |
185 | fTracePath = path; | |
186 | } | |
187 | ||
188 | /** | |
189 | * Gets the trace channels collection. | |
190 | * | |
191 | * @return trace channels | |
192 | */ | |
193 | public TraceChannels getTraceChannels() { | |
194 | return fChannels; | |
195 | } | |
196 | ||
197 | /** | |
198 | * Sets the trace channels collection. | |
199 | * | |
200 | * @param channels | |
201 | */ | |
202 | public void setTraceChannels(TraceChannels channels) { | |
203 | fChannels = channels; | |
204 | } | |
205 | ||
206 | /** | |
207 | * Sets the trace channels collection with given names | |
208 | * and creates default trace channels. | |
209 | * | |
210 | * @param channels | |
211 | */ | |
212 | public void setTraceChannels(String[] channels) { | |
213 | fChannels = new TraceChannels(); | |
214 | fChannels.putAll(channels); | |
215 | } | |
a79913eb FC |
216 | |
217 | /** | |
218 | * Gets the trace project. | |
219 | * | |
220 | * @return project | |
221 | */ | |
222 | public IProject getProject() { | |
223 | return fProject; | |
224 | } | |
225 | ||
226 | /** | |
227 | * Sets the trace project. | |
228 | * | |
229 | * @param project | |
230 | */ | |
231 | public void setProject(IProject project) { | |
232 | fProject = project; | |
233 | } | |
234 | ||
e8d771d5 | 235 | } |