ctf/tmf: allow multiple traces to be open with name clashing events
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core / src / org / eclipse / linuxtools / tmf / core / ctfadaptor / CtfTmfTrace.java
index 368b68880ec4c33e668ba0fff99919f9d48f976b..66d53cd203dcdf925bb415de9a315cd0db73b5f9 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2012, 2013 Ericsson, École Polytechnique de Montréal
+ * Copyright (c) 2012, 2014 Ericsson, École Polytechnique de Montréal
  *
  * All rights reserved. This program and the accompanying materials are made
  * available under the terms of the Eclipse Public License v1.0 which
@@ -16,7 +16,6 @@ package org.eclipse.linuxtools.tmf.core.ctfadaptor;
 
 import java.nio.BufferOverflowException;
 import java.nio.ByteBuffer;
-import java.util.Collections;
 import java.util.Map;
 
 import org.eclipse.core.resources.IProject;
@@ -37,6 +36,7 @@ import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfEventParser;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfTraceProperties;
 import org.eclipse.linuxtools.tmf.core.trace.TmfTrace;
+import org.eclipse.linuxtools.tmf.core.trace.TraceValidationStatus;
 import org.eclipse.linuxtools.tmf.core.trace.indexer.ITmfPersistentlyIndexable;
 import org.eclipse.linuxtools.tmf.core.trace.indexer.ITmfTraceIndexer;
 import org.eclipse.linuxtools.tmf.core.trace.indexer.TmfBTreeTraceIndexer;
@@ -65,6 +65,7 @@ public class CtfTmfTrace extends TmfTrace
      * The Ctf clock unique identifier field
      */
     private static final String CLOCK_HOST_PROPERTY = "uuid"; //$NON-NLS-1$
+    private static final int CONFIDENCE = 10;
 
     // -------------------------------------------
     // Fields
@@ -136,19 +137,14 @@ public class CtfTmfTrace extends TmfTrace
     }
 
     /**
-     * Method validate.
-     *
-     * @param project
-     *            IProject
-     * @param path
-     *            String
-     * @return IStatus IStatus.error or Status.OK_STATUS
-     * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#validate(IProject, String)
-     * @since 2.0
+     * {@inheritDoc}
+     * <p>
+     * The default implementation sets the confidence to 10 if the trace is a
+     * valid CTF trace.
      */
     @Override
     public IStatus validate(final IProject project, final String path) {
-        IStatus validTrace = Status.OK_STATUS;
+        IStatus validTrace = new TraceValidationStatus(CONFIDENCE, Activator.PLUGIN_ID);
         try {
             final CTFTrace temp = new CTFTrace(path);
             if (!temp.majorIsSet()) {
@@ -327,7 +323,7 @@ public class CtfTmfTrace extends TmfTrace
      */
     @Override
     public Map<String, String> getTraceProperties() {
-        return Collections.unmodifiableMap(fTrace.getEnvironment());
+        return fTrace.getEnvironment();
     }
 
     // -------------------------------------------
@@ -461,6 +457,9 @@ public class CtfTmfTrace extends TmfTrace
 
     private static int fCheckpointSize = -1;
 
+    /**
+     * @since 3.0
+     */
     @Override
     public synchronized int getCheckpointSize() {
         if (fCheckpointSize == -1) {
@@ -479,6 +478,9 @@ public class CtfTmfTrace extends TmfTrace
         return new TmfBTreeTraceIndexer(this, interval);
     }
 
+    /**
+     * @since 3.0
+     */
     @Override
     public ITmfLocation restoreLocation(ByteBuffer bufferIn) {
         return new CtfLocation(bufferIn);
This page took 0.024753 seconds and 5 git commands to generate.