ss: add a wrapper for the state system delete files
[deliverable/tracecompass.git] / statesystem / org.eclipse.tracecompass.statesystem.core / src / org / eclipse / tracecompass / internal / statesystem / core / StateSystem.java
index 4213a597c74f94dc9b27bdc0f351430f39e621d8..81b7feada9a820309077da1f1226ec4dc8395a9a 100644 (file)
@@ -17,16 +17,17 @@ package org.eclipse.tracecompass.internal.statesystem.core;
 
 import java.io.File;
 import java.io.IOException;
-import java.io.PrintWriter;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
+import java.util.logging.Logger;
 
 import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.common.core.log.TraceCompassLog;
 import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
 import org.eclipse.tracecompass.statesystem.core.backend.IStateHistoryBackend;
 import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
@@ -59,6 +60,8 @@ public class StateSystem implements ITmfStateSystemBuilder {
     private static final String PARENT = ".."; //$NON-NLS-1$
     private static final String WILDCARD = "*"; //$NON-NLS-1$
 
+    private static final Logger LOGGER = TraceCompassLog.getLogger(StateSystem.class);
+
     /* References to the inner structures */
     private final AttributeTree attributeTree;
     private final TransientState transState;
@@ -356,15 +359,8 @@ public class StateSystem implements ITmfStateSystemBuilder {
     //--------------------------------------------------------------------------
 
     @Override
-    public void modifyAttribute(long t, ITmfStateValue value, int attributeQuark)
+    public void modifyAttribute(long t, @NonNull ITmfStateValue value, int attributeQuark)
             throws TimeRangeException, StateValueTypeException {
-        if (value == null) {
-            /*
-             * TODO Replace with @NonNull parameter (will require fixing all the
-             * state providers!)
-             */
-            throw new IllegalArgumentException();
-        }
         transState.processStateChange(t, value, attributeQuark);
     }
 
@@ -383,7 +379,7 @@ public class StateSystem implements ITmfStateSystemBuilder {
     }
 
     @Override
-    public void pushAttribute(long t, ITmfStateValue value, int attributeQuark)
+    public void pushAttribute(long t, @NonNull ITmfStateValue value, int attributeQuark)
             throws TimeRangeException, StateValueTypeException {
         int stackDepth;
         int subAttributeQuark;
@@ -544,6 +540,8 @@ public class StateSystem implements ITmfStateSystemBuilder {
             throw new StateSystemDisposedException();
         }
 
+        LOGGER.info(() -> "[StateSystem:FullQueryStart] ssid=" + this.getSSID() + ", ts=" + t);  //$NON-NLS-1$//$NON-NLS-2$
+
         final int nbAttr = getNbAttributes();
         List<@Nullable ITmfStateInterval> stateInfo = new ArrayList<>(nbAttr);
 
@@ -571,6 +569,7 @@ public class StateSystem implements ITmfStateSystemBuilder {
                 throw new IllegalStateException("Incoherent interval storage"); //$NON-NLS-1$
             }
         }
+        LOGGER.info(() -> "[StateSystem:FullQueryEnd]");  //$NON-NLS-1$
         return stateInfo;
     }
 
@@ -581,6 +580,8 @@ public class StateSystem implements ITmfStateSystemBuilder {
             throw new StateSystemDisposedException();
         }
 
+        LOGGER.info(() -> "[StateSystem:SingleQueryStart] ssid=" + this.getSSID() + ", ts=" + t + ", attribute=" + attributeQuark);  //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
+
         ITmfStateInterval ret = transState.getIntervalAt(t, attributeQuark);
         if (ret == null) {
             /*
@@ -597,9 +598,15 @@ public class StateSystem implements ITmfStateSystemBuilder {
              */
             throw new IllegalStateException("Incoherent interval storage"); //$NON-NLS-1$
         }
+        LOGGER.info(() -> "[StateSystem:SingleQueryEnd]");  //$NON-NLS-1$
         return ret;
     }
 
+    @Override
+    public void removeFiles() {
+        backend.removeFiles();
+    }
+
     //--------------------------------------------------------------------------
     //        Debug methods
     //--------------------------------------------------------------------------
@@ -609,17 +616,4 @@ public class StateSystem implements ITmfStateSystemBuilder {
                 attribute + " at time " + timestamp + //$NON-NLS-1$
                 ", returning dummy interval"); //$NON-NLS-1$
     }
-
-    /**
-     * Print out the contents of the inner structures.
-     *
-     * @param writer
-     *            The PrintWriter in which to print the output
-     */
-    public void debugPrint(@NonNull PrintWriter writer) {
-        getAttributeTree().debugPrint(writer);
-        transState.debugPrint(writer);
-        backend.debugPrint(writer);
-    }
-
 }
This page took 0.025699 seconds and 5 git commands to generate.