CTF: Enhance CTF validation for invalid CTF traces (Bug 464329)
[deliverable/tracecompass.git] / org.eclipse.tracecompass.tmf.ctf.core / src / org / eclipse / tracecompass / tmf / ctf / core / trace / CtfTmfTrace.java
1 /*******************************************************************************
2 * Copyright (c) 2012, 2015 Ericsson, École Polytechnique de Montréal
3 *
4 * All rights reserved. This program and the accompanying materials are made
5 * 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 * Matthew Khouzam - Initial API and implementation
11 * Patrick Tasse - Updated for removal of context clone
12 * Geneviève Bastien - Added the createTimestamp function
13 *******************************************************************************/
14
15 package org.eclipse.tracecompass.tmf.ctf.core.trace;
16
17 import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
18
19 import java.nio.BufferOverflowException;
20 import java.nio.ByteBuffer;
21 import java.util.ArrayList;
22 import java.util.Collection;
23 import java.util.Collections;
24 import java.util.HashMap;
25 import java.util.List;
26 import java.util.Map;
27 import java.util.Set;
28
29 import org.eclipse.core.resources.IProject;
30 import org.eclipse.core.resources.IResource;
31 import org.eclipse.core.runtime.CoreException;
32 import org.eclipse.core.runtime.IStatus;
33 import org.eclipse.core.runtime.Status;
34 import org.eclipse.jdt.annotation.NonNull;
35 import org.eclipse.jdt.annotation.Nullable;
36 import org.eclipse.tracecompass.ctf.core.CTFException;
37 import org.eclipse.tracecompass.ctf.core.event.CTFCallsite;
38 import org.eclipse.tracecompass.ctf.core.event.CTFClock;
39 import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
40 import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
41 import org.eclipse.tracecompass.ctf.core.trace.CTFTraceReader;
42 import org.eclipse.tracecompass.ctf.core.trace.Metadata;
43 import org.eclipse.tracecompass.internal.tmf.ctf.core.Activator;
44 import org.eclipse.tracecompass.internal.tmf.ctf.core.trace.iterator.CtfIterator;
45 import org.eclipse.tracecompass.internal.tmf.ctf.core.trace.iterator.CtfIteratorManager;
46 import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
47 import org.eclipse.tracecompass.tmf.core.event.ITmfEventField;
48 import org.eclipse.tracecompass.tmf.core.event.TmfEventField;
49 import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
50 import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
51 import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
52 import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
53 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
54 import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
55 import org.eclipse.tracecompass.tmf.core.trace.ITmfTraceProperties;
56 import org.eclipse.tracecompass.tmf.core.trace.ITmfTraceWithPreDefinedEvents;
57 import org.eclipse.tracecompass.tmf.core.trace.TmfTrace;
58 import org.eclipse.tracecompass.tmf.core.trace.TraceValidationStatus;
59 import org.eclipse.tracecompass.tmf.core.trace.indexer.ITmfPersistentlyIndexable;
60 import org.eclipse.tracecompass.tmf.core.trace.indexer.ITmfTraceIndexer;
61 import org.eclipse.tracecompass.tmf.core.trace.indexer.TmfBTreeTraceIndexer;
62 import org.eclipse.tracecompass.tmf.core.trace.indexer.checkpoint.ITmfCheckpoint;
63 import org.eclipse.tracecompass.tmf.core.trace.indexer.checkpoint.TmfCheckpoint;
64 import org.eclipse.tracecompass.tmf.core.trace.location.ITmfLocation;
65 import org.eclipse.tracecompass.tmf.ctf.core.CtfConstants;
66 import org.eclipse.tracecompass.tmf.ctf.core.context.CtfLocation;
67 import org.eclipse.tracecompass.tmf.ctf.core.context.CtfLocationInfo;
68 import org.eclipse.tracecompass.tmf.ctf.core.context.CtfTmfContext;
69 import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
70 import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEventType;
71 import org.eclipse.tracecompass.tmf.ctf.core.event.aspect.CtfChannelAspect;
72 import org.eclipse.tracecompass.tmf.ctf.core.event.aspect.CtfCpuAspect;
73 import org.eclipse.tracecompass.tmf.ctf.core.event.lookup.CtfTmfCallsite;
74
75 import com.google.common.collect.ImmutableList;
76 import com.google.common.collect.ImmutableSet;
77
78 /**
79 * The CTf trace handler
80 *
81 * @version 1.0
82 * @author Matthew khouzam
83 */
84 public class CtfTmfTrace extends TmfTrace
85 implements ITmfTraceProperties, ITmfPersistentlyIndexable,
86 ITmfTraceWithPreDefinedEvents, AutoCloseable {
87
88 // -------------------------------------------
89 // Constants
90 // -------------------------------------------
91
92 /**
93 * Default cache size for CTF traces
94 */
95 protected static final int DEFAULT_CACHE_SIZE = 50000;
96
97 /**
98 * Event aspects available for all CTF traces
99 * @since 1.0
100 */
101 protected static final @NonNull Collection<ITmfEventAspect> CTF_ASPECTS =
102 checkNotNull(ImmutableList.of(
103 ITmfEventAspect.BaseAspects.TIMESTAMP,
104 new CtfChannelAspect(),
105 new CtfCpuAspect(),
106 ITmfEventAspect.BaseAspects.EVENT_TYPE,
107 ITmfEventAspect.BaseAspects.CONTENTS
108 ));
109
110 /**
111 * The Ctf clock unique identifier field
112 */
113 private static final String CLOCK_HOST_PROPERTY = "uuid"; //$NON-NLS-1$
114 private static final int CONFIDENCE = 10;
115 private static final int MIN_CONFIDENCE = 1;
116
117 // -------------------------------------------
118 // Fields
119 // -------------------------------------------
120
121 private final Map<String, CtfTmfEventType> fContainedEventTypes =
122 Collections.synchronizedMap(new HashMap<String, CtfTmfEventType>());
123
124 private final CtfIteratorManager fIteratorManager =
125 new CtfIteratorManager(this);
126
127 /* Reference to the CTF Trace */
128 private CTFTrace fTrace;
129
130 // -------------------------------------------
131 // TmfTrace Overrides
132 // -------------------------------------------
133 /**
134 * Method initTrace.
135 *
136 * @param resource
137 * The resource associated with this trace
138 * @param path
139 * The path to the trace file
140 * @param eventType
141 * The type of events that will be read from this trace
142 * @throws TmfTraceException
143 * If something went wrong while reading the trace
144 */
145 @Override
146 public void initTrace(final IResource resource, final String path, final Class<? extends ITmfEvent> eventType)
147 throws TmfTraceException {
148 /*
149 * Set the cache size. This has to be done before the call to super()
150 * because the super needs to know the cache size.
151 */
152 setCacheSize();
153
154 super.initTrace(resource, path, eventType);
155
156 try {
157 this.fTrace = new CTFTrace(path);
158 CtfTmfContext ctx;
159 /* Set the start and (current) end times for this trace */
160 ctx = (CtfTmfContext) seekEvent(0L);
161 CtfTmfEvent event = getNext(ctx);
162 if ((ctx.getLocation().equals(CtfIterator.NULL_LOCATION)) || (ctx.getCurrentEvent() == null)) {
163 /* Handle the case where the trace is empty */
164 this.setStartTime(TmfTimestamp.BIG_BANG);
165 } else {
166 final ITmfTimestamp curTime = event.getTimestamp();
167 this.setStartTime(curTime);
168 this.setEndTime(curTime);
169 }
170 /*
171 * Register every event type. When you call getType, it will
172 * register a trace to that type in the TmfEventTypeManager
173 */
174 try (CtfIterator iter = fIteratorManager.getIterator(ctx)) {
175 for (IEventDeclaration ied : iter.getEventDeclarations()) {
176 CtfTmfEventType ctfTmfEventType = fContainedEventTypes.get(ied.getName());
177 if (ctfTmfEventType == null) {
178 List<ITmfEventField> content = new ArrayList<>();
179 /* Should only return null the first time */
180 for (String fieldName : ied.getFields().getFieldsList()) {
181 content.add(new TmfEventField(fieldName, null, null));
182 }
183 ITmfEventField contentTree = new TmfEventField(
184 ITmfEventField.ROOT_FIELD_ID,
185 null,
186 content.toArray(new ITmfEventField[content.size()])
187 );
188
189 ctfTmfEventType = new CtfTmfEventType(ied.getName(), contentTree);
190 fContainedEventTypes.put(ctfTmfEventType.getName(), ctfTmfEventType);
191 }
192 }
193 }
194 } catch (final CTFException e) {
195 /*
196 * If it failed at the init(), we can assume it's because the file
197 * was not found or was not recognized as a CTF trace. Throw into
198 * the new type of exception expected by the rest of TMF.
199 */
200 throw new TmfTraceException(e.getMessage(), e);
201 }
202 }
203
204 @Override
205 public void close() {
206 dispose();
207 }
208
209 @Override
210 public synchronized void dispose() {
211 fIteratorManager.dispose();
212 if (fTrace != null) {
213 fTrace = null;
214 }
215 super.dispose();
216 }
217
218 /**
219 * {@inheritDoc}
220 * <p>
221 * The default implementation of a CTF trace.
222 *
223 * Firstly a weak validation of the metadata is done to determine if the
224 * path is actually for a CTF trace. After that a full validation is done.
225 *
226 * If the weak and full validation are successful the confidence is set
227 * to 10.
228 *
229 * If the weak validation was successful, but the full validation fails
230 * a TraceValidationStatus with severity warning and confidence of 1 is
231 * returned.
232 *
233 * If both weak and full validation fails an error status is returned.
234 */
235 @Override
236 public IStatus validate(final IProject project, final String path) {
237 boolean isMetadataValid = false;
238 try {
239 isMetadataValid = Metadata.preValidate(path);
240 } catch (final CTFException e) {
241 return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.CtfTmfTrace_ReadingError + ": " + e.toString(), e); //$NON-NLS-1$
242 }
243
244 if (isMetadataValid) {
245 // Trace is pre-validated, continue will full validation
246 try {
247 final CTFTrace trace = new CTFTrace(path);
248 if (!trace.majorIsSet()) {
249 if (isMetadataValid) {
250 return new TraceValidationStatus(MIN_CONFIDENCE, IStatus.WARNING, Activator.PLUGIN_ID, Messages.CtfTmfTrace_MajorNotSet, null);
251 }
252 return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.CtfTmfTrace_MajorNotSet);
253 }
254
255 // Validate using reader initialization
256 try (CTFTraceReader ctfTraceReader = new CTFTraceReader(trace)) {}
257
258 // Trace is validated, return with confidence
259 return new CtfTraceValidationStatus(CONFIDENCE, Activator.PLUGIN_ID, trace.getEnvironment());
260
261 } catch (final CTFException e) {
262 if (isMetadataValid) {
263 return new TraceValidationStatus(MIN_CONFIDENCE, IStatus.WARNING, Activator.PLUGIN_ID, Messages.CtfTmfTrace_ReadingError + ": " + e.toString(), e); //$NON-NLS-1$
264 }
265 return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.CtfTmfTrace_ReadingError + ": " + e.toString()); //$NON-NLS-1$
266 } catch (final BufferOverflowException e) {
267 if (isMetadataValid) {
268 return new TraceValidationStatus(MIN_CONFIDENCE, IStatus.WARNING, Activator.PLUGIN_ID, Messages.CtfTmfTrace_ReadingError + ": " + e.toString(), e); //$NON-NLS-1$
269 }
270 return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.CtfTmfTrace_ReadingError + ": " + e.toString()); //$NON-NLS-1$
271 }
272 }
273 return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.CtfTmfTrace_ReadingError);
274 }
275
276 @Override
277 public Iterable<ITmfEventAspect> getEventAspects() {
278 return CTF_ASPECTS;
279 }
280
281 /**
282 * Method getCurrentLocation. This is not applicable in CTF
283 *
284 * @return null, since the trace has no knowledge of the current location
285 * @see org.eclipse.tracecompass.tmf.core.trace.ITmfTrace#getCurrentLocation()
286 */
287 @Override
288 public ITmfLocation getCurrentLocation() {
289 return null;
290 }
291
292 @Override
293 public double getLocationRatio(ITmfLocation location) {
294 final CtfLocation curLocation = (CtfLocation) location;
295 final CtfTmfContext context = new CtfTmfContext(this);
296 context.setLocation(curLocation);
297 context.seek(curLocation.getLocationInfo());
298 final CtfLocationInfo currentTime = ((CtfLocationInfo) context.getLocation().getLocationInfo());
299 final long startTime = fIteratorManager.getIterator(context).getStartTime();
300 final long endTime = fIteratorManager.getIterator(context).getEndTime();
301 return ((double) currentTime.getTimestamp() - startTime)
302 / (endTime - startTime);
303 }
304
305 /**
306 * Method seekEvent.
307 *
308 * @param location
309 * ITmfLocation<?>
310 * @return ITmfContext
311 */
312 @Override
313 public synchronized ITmfContext seekEvent(final ITmfLocation location) {
314 CtfLocation currentLocation = (CtfLocation) location;
315 CtfTmfContext context = new CtfTmfContext(this);
316 if (fTrace == null) {
317 context.setLocation(null);
318 context.setRank(ITmfContext.UNKNOWN_RANK);
319 return context;
320 }
321 /*
322 * The rank is set to 0 if the iterator seeks the beginning. If not, it
323 * will be set to UNKNOWN_RANK, since CTF traces don't support seeking
324 * by rank for now.
325 */
326 if (currentLocation == null) {
327 currentLocation = new CtfLocation(new CtfLocationInfo(0L, 0L));
328 context.setRank(0);
329 }
330 if (currentLocation.getLocationInfo() == CtfLocation.INVALID_LOCATION) {
331 currentLocation = new CtfLocation(fTrace.getCurrentEndTime() + 1, 0L);
332 }
333 context.setLocation(currentLocation);
334 if (location == null) {
335 long timestamp = fIteratorManager.getIterator(context).getCurrentTimestamp();
336 currentLocation = new CtfLocation(timestamp, 0);
337 }
338 if (context.getRank() != 0) {
339 context.setRank(ITmfContext.UNKNOWN_RANK);
340 }
341 return context;
342 }
343
344 @Override
345 public synchronized ITmfContext seekEvent(double ratio) {
346 CtfTmfContext context = new CtfTmfContext(this);
347 if (fTrace == null) {
348 context.setLocation(null);
349 context.setRank(ITmfContext.UNKNOWN_RANK);
350 return context;
351 }
352 final long end = fTrace.getCurrentEndTime();
353 final long start = fTrace.getCurrentStartTime();
354 final long diff = end - start;
355 final long ratioTs = Math.round(diff * ratio) + start;
356 context.seek(ratioTs);
357 context.setRank(ITmfContext.UNKNOWN_RANK);
358 return context;
359 }
360
361 /**
362 * Method readNextEvent.
363 *
364 * @param context
365 * ITmfContext
366 * @return CtfTmfEvent
367 * @see org.eclipse.tracecompass.tmf.core.trace.ITmfTrace#getNext(ITmfContext)
368 */
369 @Override
370 public synchronized CtfTmfEvent getNext(final ITmfContext context) {
371 if (fTrace == null) {
372 return null;
373 }
374 CtfTmfEvent event = null;
375 if (context instanceof CtfTmfContext) {
376 if (context.getLocation() == null || CtfLocation.INVALID_LOCATION.equals(context.getLocation().getLocationInfo())) {
377 return null;
378 }
379 CtfTmfContext ctfContext = (CtfTmfContext) context;
380 event = ctfContext.getCurrentEvent();
381
382 if (event != null) {
383 updateAttributes(context, event.getTimestamp());
384 ctfContext.advance();
385 ctfContext.increaseRank();
386 }
387 }
388
389 return event;
390 }
391
392 /**
393 * Ctf traces have a clock with a unique uuid that will be used to identify
394 * the host. Traces with the same clock uuid will be known to have been made
395 * on the same machine.
396 *
397 * Note: uuid is an optional field, it may not be there for a clock.
398 */
399 @Override
400 public String getHostId() {
401 CTFClock clock = fTrace.getClock();
402 if (clock != null) {
403 String clockHost = (String) clock.getProperty(CLOCK_HOST_PROPERTY);
404 if (clockHost != null) {
405 return clockHost;
406 }
407 }
408 return super.getHostId();
409 }
410
411 /**
412 * Get the first callsite that matches the event name
413 *
414 * @param eventName The event name to look for
415 * @return The best callsite candidate
416 */
417 public @Nullable CtfTmfCallsite getCallsite(String eventName) {
418 CTFCallsite callsite = fTrace.getCallsite(eventName);
419 if (callsite != null) {
420 return new CtfTmfCallsite(callsite);
421 }
422 return null;
423 }
424
425 /**
426 * Get the closest matching callsite for given event name and instruction
427 * pointer
428 *
429 * @param eventName
430 * The event name
431 * @param ip
432 * The instruction pointer
433 * @return The closest matching callsite
434 */
435 public @Nullable CtfTmfCallsite getCallsite(String eventName, long ip) {
436 CTFCallsite calliste = fTrace.getCallsite(eventName, ip);
437 if (calliste != null) {
438 return new CtfTmfCallsite(calliste);
439 }
440 return null;
441 }
442
443 /**
444 * Get the CTF environment variables defined in this CTF trace, in <name,
445 * value> form. This comes from the trace's CTF metadata.
446 *
447 * @return The CTF environment
448 */
449 public Map<String, String> getEnvironment() {
450 return fTrace.getEnvironment();
451 }
452
453 // -------------------------------------------
454 // ITmfTraceProperties
455 // -------------------------------------------
456
457 @Override
458 public Map<String, String> getTraceProperties() {
459 Map<String, String> properties = new HashMap<>();
460 properties.putAll(fTrace.getEnvironment());
461 properties.put(Messages.CtfTmfTrace_HostID, getHostId());
462 return properties;
463 }
464
465 // -------------------------------------------
466 // Clocks
467 // -------------------------------------------
468
469 /**
470 * gets the clock offset
471 *
472 * @return the clock offset in ns
473 */
474 public long getOffset() {
475 if (fTrace != null) {
476 return fTrace.getOffset();
477 }
478 return 0;
479 }
480
481 /**
482 * Convert a CTF timestamp in CPU cycles to its equivalent in nanoseconds
483 * for this trace.
484 *
485 * @param cycles
486 * The timestamp in cycles
487 * @return The timestamp in nanoseconds
488 */
489 public long timestampCyclesToNanos(long cycles) {
490 return fTrace.timestampCyclesToNanos(cycles);
491 }
492
493 /**
494 * Convert a CTF timestamp in nanoseconds to its equivalent in CPU cycles
495 * for this trace.
496 *
497 * @param nanos
498 * The timestamp in nanoseconds
499 * @return The timestamp in cycles
500 */
501 public long timestampNanoToCycles(long nanos) {
502 return fTrace.timestampNanoToCycles(nanos);
503 }
504
505 /**
506 * Gets the list of declared events
507 */
508 @Override
509 public Set<CtfTmfEventType> getContainedEventTypes() {
510 return ImmutableSet.copyOf(fContainedEventTypes.values());
511 }
512
513 /**
514 * Register an event type to this trace.
515 *
516 * Public visibility so that {@link CtfTmfEvent#getType} can call it.
517 *
518 * FIXME This could probably be made cleaner?
519 *
520 * @param eventType
521 * The event type to register
522 */
523 public void registerEventType(CtfTmfEventType eventType) {
524 fContainedEventTypes.put(eventType.getName(), eventType);
525 }
526
527 // -------------------------------------------
528 // Parser
529 // -------------------------------------------
530
531 @Override
532 public CtfTmfEvent parseEvent(ITmfContext context) {
533 CtfTmfEvent event = null;
534 if (context instanceof CtfTmfContext) {
535 final ITmfContext tmpContext = seekEvent(context.getLocation());
536 event = getNext(tmpContext);
537 }
538 return event;
539 }
540
541 /**
542 * Sets the cache size for a CtfTmfTrace.
543 */
544 protected void setCacheSize() {
545 setCacheSize(DEFAULT_CACHE_SIZE);
546 }
547
548 // -------------------------------------------
549 // CtfIterator factory methods
550 // -------------------------------------------
551
552 /**
553 * Get an iterator to the trace
554 *
555 * @return an iterator to the trace
556 */
557 public ITmfContext createIterator() {
558 try {
559 return new CtfIterator(fTrace, this);
560 } catch (CTFException e) {
561 Activator.getDefault().logError(e.getMessage(), e);
562 }
563 return null;
564 }
565
566 /**
567 * Get an iterator to the trace, , which will initially point to the given
568 * location/rank.
569 *
570 * @param ctfLocationData
571 * The initial timestamp the iterator will be pointing to
572 * @param rank
573 * The initial rank
574 * @return The new iterator
575 */
576 public ITmfContext createIterator(CtfLocationInfo ctfLocationData, long rank) {
577 try {
578 return new CtfIterator(fTrace, this, ctfLocationData, rank);
579 } catch (CTFException e) {
580 Activator.getDefault().logError(e.getMessage(), e);
581 }
582 return null;
583 }
584
585 /**
586 * Create the 'CtfIterator' object from a CtfTmfContext.
587 *
588 * @param context
589 * The iterator will initially be pointing to this context
590 * @return A new CtfIterator object
591 * @since 1.0
592 */
593 public ITmfContext createIteratorFromContext(CtfTmfContext context) {
594 return fIteratorManager.getIterator(context);
595 }
596
597 /**
598 * Dispose an iterator that was create with
599 * {@link #createIteratorFromContext}
600 *
601 * @param context
602 * The last context that was pointed to by the iterator (this is
603 * the 'key' to find the correct iterator to dispose).
604 * @since 1.0
605 */
606 public void disposeContext(CtfTmfContext context) {
607 fIteratorManager.removeIterator(context);
608 }
609
610 // ------------------------------------------------------------------------
611 // Timestamp transformation functions
612 // ------------------------------------------------------------------------
613
614 /**
615 * @since 1.0
616 */
617 @Override
618 public @NonNull TmfNanoTimestamp createTimestamp(long ts) {
619 return new TmfNanoTimestamp(getTimestampTransform().transform(ts));
620 }
621
622 private static int fCheckpointSize = -1;
623
624 @Override
625 public synchronized int getCheckpointSize() {
626 if (fCheckpointSize == -1) {
627 TmfCheckpoint c = new TmfCheckpoint(new TmfNanoTimestamp(0), new CtfLocation(0, 0), 0);
628 ByteBuffer b = ByteBuffer.allocate(ITmfCheckpoint.MAX_SERIALIZE_SIZE);
629 b.clear();
630 c.serialize(b);
631 fCheckpointSize = b.position();
632 }
633
634 return fCheckpointSize;
635 }
636
637 @Override
638 protected ITmfTraceIndexer createIndexer(int interval) {
639 return new TmfBTreeTraceIndexer(this, interval);
640 }
641
642 @Override
643 public ITmfLocation restoreLocation(ByteBuffer bufferIn) {
644 return new CtfLocation(bufferIn);
645 }
646
647 @Override
648 public boolean isComplete() {
649 if (getResource() == null) {
650 return true;
651 }
652
653 String host = null;
654 String port = null;
655 String sessionName = null;
656 try {
657 host = getResource().getPersistentProperty(CtfConstants.LIVE_HOST);
658 port = getResource().getPersistentProperty(CtfConstants.LIVE_PORT);
659 sessionName = getResource().getPersistentProperty(CtfConstants.LIVE_SESSION_NAME);
660 } catch (CoreException e) {
661 Activator.getDefault().logError(e.getMessage(), e);
662 // Something happened to the resource, assume we won't get any more
663 // data from it
664 return true;
665 }
666 return host == null || port == null || sessionName == null;
667 }
668
669 @Override
670 public void setComplete(final boolean isComplete) {
671 super.setComplete(isComplete);
672 try {
673 if (isComplete) {
674 getResource().setPersistentProperty(CtfConstants.LIVE_HOST, null);
675 getResource().setPersistentProperty(CtfConstants.LIVE_PORT, null);
676 getResource().setPersistentProperty(CtfConstants.LIVE_SESSION_NAME, null);
677 }
678 } catch (CoreException e) {
679 Activator.getDefault().logError(e.getMessage(), e);
680 }
681 }
682 }
This page took 0.058374 seconds and 5 git commands to generate.