Minor API improvements
authorFrancois Chouinard <fchouinard@gmail.com>
Thu, 26 Apr 2012 23:30:33 +0000 (19:30 -0400)
committerFrancois Chouinard <fchouinard@gmail.com>
Fri, 27 Apr 2012 03:02:52 +0000 (23:02 -0400)
org.eclipse.linuxtools.lttng.core/src/org/eclipse/linuxtools/internal/lttng/core/trace/LTTngTextTrace.java
org.eclipse.linuxtools.lttng.core/src/org/eclipse/linuxtools/internal/lttng/core/trace/LTTngTrace.java
org.eclipse.linuxtools.lttng.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng/stubs/LTTngEventParserStub.java
org.eclipse.linuxtools.lttng.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng/stubs/LTTngTraceStub.java
org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/trace/TmfEventParserStub.java
org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/trace/TmfTraceStub.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/ITmfContext.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/ITmfEventParser.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfTrace.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/custom/CustomTxtTrace.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/custom/CustomXmlTrace.java

index 7a970c1a575d51995a77a462c94e1089cf48bc24..0fc81a174c024fe024ade9197206dcbc5241b35a 100644 (file)
@@ -17,6 +17,7 @@ import java.io.FileReader;
 import java.io.IOException;
 import java.util.HashMap;
 
+import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IResource;
 import org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent;
 import org.eclipse.linuxtools.internal.lttng.core.event.LttngEventContent;
@@ -82,7 +83,7 @@ public class LTTngTextTrace extends TmfTrace<LttngEvent> implements ITmfEventPar
 //            fCheckpoints.add(new TmfCheckpoint(new LttngTimestamp(0L), new TmfLocation<Long>(0L)));
             ITmfContext context = new TmfContext(new TmfLocation<Long>(0L), 0);
             fIndexer.updateIndex(context, new LttngTimestamp(0L));
-            fParser = (ITmfEventParser) this;
+            fParser = (ITmfEventParser<LttngEvent>) this;
             //         }
             //         else {
             //                 indexTrace(true);
@@ -418,6 +419,14 @@ public class LTTngTextTrace extends TmfTrace<LttngEvent> implements ITmfEventPar
         return cpuNumber;
     }
 
+    /* (non-Javadoc)
+     * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#validate(org.eclipse.core.resources.IProject, java.lang.String)
+     */
+    @Override
+    public boolean validate(IProject project, String path) {
+        return fileExists(path);
+    }
+
 }
 
 
index 8531c8ca153440d2b5cd1c0ed7acb641c24662d8..842f7cc3f06cb862f820c773d20675029e179811 100644 (file)
@@ -103,7 +103,7 @@ public class LTTngTrace extends TmfTrace<LttngEvent> implements ITmfEventParser<
 
     @Override
     public boolean validate(final IProject project, final String path) {
-        if (super.validate(project, path)) {
+        if (fileExists(path)) {
             final String traceLibPath = TraceHelper.getTraceLibDirFromProject(project);
             try {
                 final LTTngTraceVersion version = new LTTngTraceVersion(path, traceLibPath);
@@ -153,7 +153,7 @@ public class LTTngTrace extends TmfTrace<LttngEvent> implements ITmfEventParser<
         // Set the currentEvent to the eventContent
         eventContent.setEvent(currentLttngEvent);
 
-        fParser = (ITmfEventParser) this;
+        fParser = (ITmfEventParser<LttngEvent>) this;
         fCacheSize = CHECKPOINT_PAGE_SIZE;
  
         // // Bypass indexing if asked
@@ -458,7 +458,7 @@ public class LTTngTrace extends TmfTrace<LttngEvent> implements ITmfEventParser<
         if (location == null) {
             curLocation = new LttngLocation();
             final TmfContext context = seekEvent(curLocation.getOperationTime());
-            context.setRank(ITmfContext.INITIAL_RANK);
+            context.setRank(0);
             return context;
         } else
             curLocation = (LttngLocation) location;
index 6a3415b6852b5c9b425e7607f6977725266b98c4..40599587b302c55c2e41ec270b5bc85d095f5e7b 100644 (file)
 
 package org.eclipse.linuxtools.internal.lttng.stubs;
 
-import java.io.IOException;
-
 import org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent;
-import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfEventParser;
 
@@ -30,7 +27,7 @@ public class LTTngEventParserStub implements ITmfEventParser<LttngEvent> {
      * @see org.eclipse.linuxtools.tmf.core.parser.ITmfEventParser#parseNextEvent(org.eclipse.linuxtools.tmf.core.trace.ITmfTrace, org.eclipse.linuxtools.tmf.core.trace.TmfContext)
      */
     @Override
-    public ITmfEvent parseEvent(ITmfContext context) {
+    public LttngEvent parseEvent(ITmfContext context) {
         // TODO Auto-generated method stub
         return null;
     }
index 2743c538d362015c7958274c08a717833da84fb1..3c55153ab2cbb0023d84126b46113299f646d3d5 100644 (file)
@@ -16,9 +16,9 @@ import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.RandomAccessFile;
 
+import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IResource;
 import org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent;
-import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
 import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfEventParser;
@@ -143,7 +143,7 @@ public class LTTngTraceStub extends TmfTrace<LttngEvent> implements ITmfEventPar
      * @see org.eclipse.linuxtools.tmf.trace.ITmfTrace#parseEvent()
      */
     @Override
-    public ITmfEvent parseEvent(final ITmfContext context) {
+    public LttngEvent parseEvent(final ITmfContext context) {
 //        try {
             // paserNextEvent updates the context
             final LttngEvent event = (LttngEvent) fParser.parseEvent(context);
@@ -166,6 +166,14 @@ public class LTTngTraceStub extends TmfTrace<LttngEvent> implements ITmfEventPar
         return "[LTTngTraceStub]";
     }
 
+    /* (non-Javadoc)
+     * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#validate(org.eclipse.core.resources.IProject, java.lang.String)
+     */
+    @Override
+    public boolean validate(IProject project, String path) {
+        return fileExists(path);
+    }
+
     //    // ========================================================================
     //    // Helper functions
     //    // ========================================================================
index 70b3b6c45a119f5b50cf823c6cdef3b207b2f325..47f64a6f8e1ff8b5517c3775f1a1d1a6a1a0fa2c 100644 (file)
@@ -17,7 +17,6 @@ import java.io.IOException;
 import java.io.RandomAccessFile;
 import java.util.Vector;
 
-import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
 import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
 import org.eclipse.linuxtools.tmf.core.event.TmfEvent;
 import org.eclipse.linuxtools.tmf.core.event.TmfEventField;
@@ -34,7 +33,7 @@ import org.eclipse.linuxtools.tmf.core.trace.TmfLocation;
  * TODO: Implement me. Please.
  */
 @SuppressWarnings("nls")
-public class TmfEventParserStub implements ITmfEventParser<ITmfEvent> {
+public class TmfEventParserStub implements ITmfEventParser<TmfEvent> {
 
     // ------------------------------------------------------------------------
     // Attributes
@@ -70,7 +69,7 @@ public class TmfEventParserStub implements ITmfEventParser<ITmfEvent> {
     static final String typePrefix = "Type-";
     @Override
     @SuppressWarnings("unchecked")
-    public ITmfEvent parseEvent(final ITmfContext context) {
+    public TmfEvent parseEvent(final ITmfContext context) {
 
         if (! (fEventStream instanceof TmfTraceStub))
             return null;
@@ -106,7 +105,7 @@ public class TmfEventParserStub implements ITmfEventParser<ITmfEvent> {
             content.append("]");
 
             final TmfEventField root = new TmfEventField(ITmfEventField.ROOT_FIELD_ID, content.toString());
-            final ITmfEvent event = new TmfEvent(fEventStream,
+            final TmfEvent event = new TmfEvent(fEventStream,
                     new TmfTimestamp(ts, -3, 0),     // millisecs
                     source, fTypes[typeIndex], root, reference.toString());
             return event;
index cc0595a48b472b2a60df2b5b016dd6274e0338bd..b12336831060337bca8bb5d7c42be01705cc450b 100644 (file)
@@ -17,8 +17,8 @@ import java.io.IOException;
 import java.io.RandomAccessFile;
 import java.util.concurrent.locks.ReentrantLock;
 
+import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IResource;
-import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
 import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
 import org.eclipse.linuxtools.tmf.core.event.TmfEvent;
 import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
@@ -154,7 +154,6 @@ public class TmfTraceStub extends TmfTrace<TmfEvent> implements ITmfEventParser<
      * @param parser
      * @throws FileNotFoundException
      */
-    @SuppressWarnings("unchecked")
     public TmfTraceStub(final String path, final int cacheSize, final boolean waitForCompletion,
             final ITmfEventParser<TmfEvent> parser, final ITmfTraceIndexer<?> indexer) throws TmfTraceException {
         super(null, TmfEvent.class, path, cacheSize, 0, indexer);
@@ -163,7 +162,7 @@ public class TmfTraceStub extends TmfTrace<TmfEvent> implements ITmfEventParser<
         } catch (FileNotFoundException e) {
             throw new TmfTraceException(e.getMessage());
         }
-        fParser = (ITmfEventParser<ITmfEvent>) ((parser != null) ? parser : new TmfEventParserStub(this));
+        fParser = (parser != null) ? parser : new TmfEventParserStub(this);
     }
 
     /**
@@ -267,8 +266,7 @@ public class TmfTraceStub extends TmfTrace<TmfEvent> implements ITmfEventParser<
     }
 
     @Override
-    @SuppressWarnings("rawtypes")
-    public double getLocationRatio(final ITmfLocation location) {
+    public double getLocationRatio(ITmfLocation<?> location) {
         fLock.lock();
         try {
             if (fTrace != null)
@@ -297,12 +295,12 @@ public class TmfTraceStub extends TmfTrace<TmfEvent> implements ITmfEventParser<
     }
 
     @Override
-    public ITmfEvent parseEvent(final ITmfContext context) {
+    public TmfEvent parseEvent(final ITmfContext context) {
         fLock.lock();
         try {
             // parseNextEvent will update the context
             if (fTrace != null) {
-                final ITmfEvent event = fParser.parseEvent(context.clone());
+                final TmfEvent event = fParser.parseEvent(context.clone());
                 return event;
             }
 //        }
@@ -350,4 +348,12 @@ public class TmfTraceStub extends TmfTrace<TmfEvent> implements ITmfEventParser<
         super.dispose();
     }
 
+    /* (non-Javadoc)
+     * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#validate(org.eclipse.core.resources.IProject, java.lang.String)
+     */
+    @Override
+    public boolean validate(IProject project, String path) {
+        return fileExists(path);
+    }
+
 }
\ No newline at end of file
index 2d7aed53660aa126178d8ab057bcc5dc29299eca..1d55cdd4fe9c76afe0a28fc2c4b9d58bf66b2f8d 100644 (file)
@@ -28,15 +28,10 @@ public interface ITmfContext extends Cloneable {
     // Constants
     // ------------------------------------------------------------------------
 
-    /**
-     * The initial context event rank, before anything is read from the trace
-     */
-    public long INITIAL_RANK = -1L;
-
     /**
      * The unknown event rank
      */
-    public long UNKNOWN_RANK = -2L;
+    public long UNKNOWN_RANK = -1L;
 
     // ------------------------------------------------------------------------
     // Getters
index 74fa648a9120f6ec31e70d4c102ebf52d934f2fc..01cb88de66411dd5b91ffb30615d02de7997a29c 100644 (file)
@@ -27,6 +27,6 @@ public interface ITmfEventParser<T extends ITmfEvent> {
         * @param context
         * @return
         */
-       public ITmfEvent parseEvent(ITmfContext context);
+       public T parseEvent(ITmfContext context);
 
 }
index e72dc7350dbf5de5892a63bb6ae61bf3194993c4..d41598213905d16ae5cdd5c0b39bcc79cb601651 100644 (file)
@@ -16,7 +16,6 @@ package org.eclipse.linuxtools.tmf.core.trace;
 import java.io.File;
 import java.io.FileNotFoundException;
 
-import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.linuxtools.tmf.core.component.TmfEventProvider;
@@ -97,7 +96,7 @@ public abstract class TmfTrace<T extends ITmfEvent> extends TmfEventProvider<T>
     /**
      * The trace parser
      */
-    protected ITmfEventParser<ITmfEvent> fParser;
+    protected ITmfEventParser<T> fParser;
 
     // ------------------------------------------------------------------------
     // Construction
@@ -120,7 +119,7 @@ public abstract class TmfTrace<T extends ITmfEvent> extends TmfEventProvider<T>
      * @param type the trace event type
      * @param path the trace path
      * @param cacheSize the trace cache size
-     * @throws FileNotFoundException
+     * @throws TmfTraceException
      */
     protected TmfTrace(final IResource resource, final Class<T> type, final String path, final int cacheSize) throws TmfTraceException {
         this(resource, type, path, cacheSize, 0, null);
@@ -135,7 +134,7 @@ public abstract class TmfTrace<T extends ITmfEvent> extends TmfEventProvider<T>
      * @param path the trace path
      * @param cacheSize the trace cache size
      * @param interval the trace streaming interval
-     * @throws FileNotFoundException
+     * @throws TmfTraceException
      */
     protected TmfTrace(final IResource resource, final Class<T> type, final String path, final int cacheSize, final long interval) throws TmfTraceException {
         this(resource, type, path, cacheSize, interval, null);
@@ -150,7 +149,7 @@ public abstract class TmfTrace<T extends ITmfEvent> extends TmfEventProvider<T>
      * @param path the trace path
      * @param cacheSize the trace cache size
      * @param indexer the trace indexer
-     * @throws FileNotFoundException
+     * @throws TmfTraceException
      */
     protected TmfTrace(final IResource resource, final Class<T> type, final String path, final int cacheSize,
             final long interval, final ITmfTraceIndexer<?> indexer) throws TmfTraceException {
@@ -166,11 +165,11 @@ public abstract class TmfTrace<T extends ITmfEvent> extends TmfEventProvider<T>
      * @param cacheSize the trace cache size
      * @param indexer the trace indexer
      * @param parser the trace event parser
-     * @throws FileNotFoundException
+     * @throws TmfTraceException
      */
     @SuppressWarnings({ "unchecked", "rawtypes" })
     protected TmfTrace(final IResource resource, final Class<T> type, final String path, final int cacheSize,
-            final long interval, final ITmfTraceIndexer<?> indexer, final ITmfEventParser<ITmfEvent> parser) throws TmfTraceException {
+            final long interval, final ITmfTraceIndexer<?> indexer, final ITmfEventParser<T> parser) throws TmfTraceException {
         super();
         fCacheSize = (cacheSize > 0) ? cacheSize : DEFAULT_TRACE_CACHE_SIZE;
         fStreamingInterval = interval;
@@ -218,6 +217,7 @@ public abstract class TmfTrace<T extends ITmfEvent> extends TmfEventProvider<T>
      * 
      * @throws FileNotFoundException
      */
+    @SuppressWarnings("unchecked")
     protected void initialize(final IResource resource, final String path, final Class<T> type) throws TmfTraceException {
         if (path == null)
             throw new TmfTraceException("Invalid trace path"); //$NON-NLS-1$
@@ -229,18 +229,23 @@ public abstract class TmfTrace<T extends ITmfEvent> extends TmfEventProvider<T>
             final int sep = path.lastIndexOf(Path.SEPARATOR);
             traceName = (sep >= 0) ? path.substring(sep + 1) : path;
         }
-        if (fParser == null && !(this instanceof ITmfEventParser))
-            throw new TmfTraceException("Invalid trace parser"); //$NON-NLS-1$
+        if (fParser == null) {
+            if (this instanceof ITmfEventParser) {
+                fParser = (ITmfEventParser<T>) this;
+            } else {
+                throw new TmfTraceException("Invalid trace parser"); //$NON-NLS-1$
+            }
+        }
         super.init(traceName, type);
     }
 
-    /* (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#validate(org.eclipse.core.resources.IProject, java.lang.String)
+    /**
+     * Indicates if the path points to an existing file/directory
      * 
-     * Default validation: make sure the trace file exists.
+     * @param path the path to test
+     * @return true if the file/directory exists
      */
-    @Override
-    public boolean validate(final IProject project, final String path) {
+    protected boolean fileExists(final String path) {
         final File file = new File(path);
         return file.exists();
     }
@@ -378,8 +383,11 @@ public abstract class TmfTrace<T extends ITmfEvent> extends TmfEventProvider<T>
     public synchronized ITmfContext seekEvent(final long rank) {
 
         // A rank <= 0 indicates to seek the first event
-        if (rank <= 0)
-            return seekEvent((ITmfLocation<?>) null);
+        if (rank <= 0) {
+            ITmfContext context = seekEvent((ITmfLocation<?>) null);
+            context.setRank(0);
+            return context;
+        }
 
         // Position the trace at the checkpoint
         final ITmfContext context = fIndexer.seekIndex(rank);
@@ -402,8 +410,11 @@ public abstract class TmfTrace<T extends ITmfEvent> extends TmfEventProvider<T>
     public synchronized ITmfContext seekEvent(final ITmfTimestamp timestamp) {
 
         // A null timestamp indicates to seek the first event
-        if (timestamp == null)
-            return seekEvent(0);
+        if (timestamp == null) {
+            ITmfContext context = seekEvent((ITmfLocation<?>) null);
+            context.setRank(0);
+            return context;
+        }
 
         // Position the trace at the checkpoint
         final ITmfContext context = fIndexer.seekIndex(timestamp);
index 512088bf1a6cfdaecb72403b6397696ddaa1cec8..059622a5d4133ff4332f79c625b616adc75023a3 100644 (file)
@@ -21,6 +21,7 @@ import java.util.List;
 import java.util.Map.Entry;\r
 import java.util.regex.Matcher;\r
 \r
+import org.eclipse.core.resources.IProject;\r
 import org.eclipse.core.resources.IResource;\r
 import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomTxtTraceDefinition.InputLine;\r
 import org.eclipse.linuxtools.tmf.core.event.TmfEvent;\r
@@ -60,7 +61,7 @@ public class CustomTxtTrace extends TmfTrace<CustomTxtEvent> implements ITmfEven
 \r
     @Override\r
     public TmfContext seekEvent(final ITmfLocation<?> location) {\r
-        final CustomTxtTraceContext context = new CustomTxtTraceContext(NULL_LOCATION, ITmfContext.INITIAL_RANK);\r
+        final CustomTxtTraceContext context = new CustomTxtTraceContext(NULL_LOCATION, ITmfContext.UNKNOWN_RANK);\r
         if (NULL_LOCATION.equals(location) || !new File(getPath()).isFile())\r
             return context;\r
         BufferedRandomAccessFile raFile = null;\r
@@ -123,10 +124,10 @@ public class CustomTxtTrace extends TmfTrace<CustomTxtEvent> implements ITmfEven
             return context;\r
         } catch (final FileNotFoundException e) {\r
             e.printStackTrace();\r
-            return new CustomTxtTraceContext(NULL_LOCATION, ITmfContext.INITIAL_RANK);\r
+            return new CustomTxtTraceContext(NULL_LOCATION, ITmfContext.UNKNOWN_RANK);\r
         } catch (final IOException e) {\r
             e.printStackTrace();\r
-            return new CustomTxtTraceContext(NULL_LOCATION, ITmfContext.INITIAL_RANK);\r
+            return new CustomTxtTraceContext(NULL_LOCATION, ITmfContext.UNKNOWN_RANK);\r
         } finally {\r
             if (raFile != null) {\r
                 try {\r
@@ -178,7 +179,7 @@ public class CustomTxtTrace extends TmfTrace<CustomTxtEvent> implements ITmfEven
     }\r
 \r
     @Override\r
-    public TmfEvent parseEvent(final ITmfContext tmfContext) {\r
+    public CustomTxtEvent parseEvent(final ITmfContext tmfContext) {\r
         if (!(tmfContext instanceof CustomTxtTraceContext))\r
             return null;\r
 \r
@@ -329,4 +330,12 @@ public class CustomTxtTrace extends TmfTrace<CustomTxtEvent> implements ITmfEven
     public CustomTraceDefinition getDefinition() {\r
         return fDefinition;\r
     }\r
+\r
+    /* (non-Javadoc)\r
+     * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#validate(org.eclipse.core.resources.IProject, java.lang.String)\r
+     */\r
+    @Override\r
+    public boolean validate(IProject project, String path) {\r
+        return fileExists(path);\r
+    }\r
 }\r
index b6d1b3c9b7b1ded7a206d106a26ca9f859d71031..bc5ff987a4d0f488351be6a8cb4f659bf47ceafd 100644 (file)
@@ -22,6 +22,7 @@ import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;\r
 import javax.xml.parsers.ParserConfigurationException;\r
 \r
+import org.eclipse.core.resources.IProject;\r
 import org.eclipse.core.resources.IResource;\r
 import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomXmlTraceDefinition.InputAttribute;\r
 import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomXmlTraceDefinition.InputElement;\r
@@ -74,7 +75,7 @@ public class CustomXmlTrace extends TmfTrace<CustomXmlEvent> implements ITmfEven
 \r
     @Override\r
     public TmfContext seekEvent(final ITmfLocation<?> location) {\r
-        final CustomXmlTraceContext context = new CustomXmlTraceContext(NULL_LOCATION, ITmfContext.INITIAL_RANK);\r
+        final CustomXmlTraceContext context = new CustomXmlTraceContext(NULL_LOCATION, ITmfContext.UNKNOWN_RANK);\r
         if (NULL_LOCATION.equals(location) || !new File(getPath()).isFile())\r
             return context;\r
         try {\r
@@ -125,10 +126,10 @@ public class CustomXmlTrace extends TmfTrace<CustomXmlEvent> implements ITmfEven
             return context;\r
         } catch (final FileNotFoundException e) {\r
             e.printStackTrace();\r
-            return new CustomXmlTraceContext(NULL_LOCATION, ITmfContext.INITIAL_RANK);\r
+            return new CustomXmlTraceContext(NULL_LOCATION, ITmfContext.UNKNOWN_RANK);\r
         } catch (final IOException e) {\r
             e.printStackTrace();\r
-            return new CustomXmlTraceContext(NULL_LOCATION, ITmfContext.INITIAL_RANK);\r
+            return new CustomXmlTraceContext(NULL_LOCATION, ITmfContext.UNKNOWN_RANK);\r
         } finally {\r
             if (raFile != null) {\r
                 try {\r
@@ -180,7 +181,7 @@ public class CustomXmlTrace extends TmfTrace<CustomXmlEvent> implements ITmfEven
     }\r
 \r
     @Override\r
-    public TmfEvent parseEvent(final ITmfContext tmfContext) {\r
+    public CustomXmlEvent parseEvent(final ITmfContext tmfContext) {\r
         if (!(tmfContext instanceof CustomXmlTraceContext))\r
             return null;\r
 \r
@@ -278,7 +279,7 @@ public class CustomXmlTrace extends TmfTrace<CustomXmlEvent> implements ITmfEven
                     readElement(buffer, raFile);\r
                 } else if (c == '/' && numRead == 1) {\r
                     break; // found "</"\r
-                } else if (c == '-' && numRead == 3 && buffer.substring(buffer.length() - 3, buffer.length() - 1).equals("!-")) {\r
+                } else if (c == '-' && numRead == 3 && buffer.substring(buffer.length() - 3, buffer.length() - 1).equals("!-")) { //$NON-NLS-1$\r
                     readComment(buffer, raFile); // found "<!--"\r
                 } else if (i == '>')\r
                     if (buffer.charAt(buffer.length() - 2) == '/') {\r
@@ -321,7 +322,7 @@ public class CustomXmlTrace extends TmfTrace<CustomXmlEvent> implements ITmfEven
                 numRead++;\r
                 final char c = (char)i;\r
                 buffer.append(c);\r
-                if (c == '>' && numRead >= 2 && buffer.substring(buffer.length() - 3, buffer.length() - 1).equals("--"))\r
+                if (c == '>' && numRead >= 2 && buffer.substring(buffer.length() - 3, buffer.length() - 1).equals("--")) //$NON-NLS-1$\r
                 {\r
                     break; // found "-->"\r
                 }\r
@@ -410,4 +411,12 @@ public class CustomXmlTrace extends TmfTrace<CustomXmlEvent> implements ITmfEven
     public CustomTraceDefinition getDefinition() {\r
         return fDefinition;\r
     }\r
+\r
+    /* (non-Javadoc)\r
+     * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#validate(org.eclipse.core.resources.IProject, java.lang.String)\r
+     */\r
+    @Override\r
+    public boolean validate(IProject project, String path) {\r
+        return fileExists(path);\r
+    }\r
 }\r
This page took 0.041279 seconds and 5 git commands to generate.