lttng: Add snapshot support - LTTng Tools v2.3
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng2.core / src / org / eclipse / linuxtools / internal / lttng2 / core / control / model / impl / SessionInfo.java
index ec6b95344281f2839ffb72b5b4947e3050da3d16..ac660757e32aae93250b31f46e6f22dc2622a17f 100644 (file)
@@ -18,6 +18,7 @@ import java.util.List;
 
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.IDomainInfo;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.ISessionInfo;
+import org.eclipse.linuxtools.internal.lttng2.core.control.model.ISnapshotInfo;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceSessionState;
 
 /**
@@ -49,6 +50,11 @@ public class SessionInfo extends TraceInfo implements ISessionInfo {
      * Flag to indicate whether trace is streamed over network or not.
      */
     private boolean fIsStreamedTrace = false;
+    /**
+     * Flag to indicate whether the session is a snapshot session or not.
+     */
+    private ISnapshotInfo fSnapshotInfo = null;
+
 
     // ------------------------------------------------------------------------
     // Constructors
@@ -70,6 +76,7 @@ public class SessionInfo extends TraceInfo implements ISessionInfo {
         fState = other.fState;
         fSessionPath = other.fSessionPath;
         fIsStreamedTrace = other.fIsStreamedTrace;
+        fSnapshotInfo = other.fSnapshotInfo;
 
         for (Iterator<IDomainInfo> iterator = other.fDomains.iterator(); iterator.hasNext();) {
             IDomainInfo domain = iterator.next();
@@ -106,6 +113,9 @@ public class SessionInfo extends TraceInfo implements ISessionInfo {
 
     @Override
     public String getSessionPath() {
+        if(isSnapshotSession()) {
+            return fSnapshotInfo.getSnapshotPath();
+        }
         return fSessionPath;
     }
 
@@ -130,6 +140,9 @@ public class SessionInfo extends TraceInfo implements ISessionInfo {
 
     @Override
     public boolean isStreamedTrace() {
+        if (isSnapshotSession()) {
+            return fSnapshotInfo.isStreamedSnapshot();
+        }
         return fIsStreamedTrace;
     }
 
@@ -138,67 +151,47 @@ public class SessionInfo extends TraceInfo implements ISessionInfo {
         fIsStreamedTrace = isStreamedTrace;
     }
 
-    // ------------------------------------------------------------------------
-    // Operations
-    // ------------------------------------------------------------------------
+    @Override
+    public boolean isSnapshotSession() {
+        return fSnapshotInfo != null;
+    }
 
     @Override
-    public void addDomain(IDomainInfo domainInfo) {
-        fDomains.add(domainInfo);
+    public ISnapshotInfo getSnapshotInfo() {
+        return fSnapshotInfo;
     }
 
     @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = super.hashCode();
-        result = prime * result + fDomains.hashCode();
-        result = prime * result + (fIsStreamedTrace ? 1231 : 1237);
-        result = prime * result + ((fSessionPath == null) ? 0 : fSessionPath.hashCode());
-        result = prime * result + ((fState == null) ? 0 : fState.hashCode());
-        return result;
+    public void setSnapshotInfo(ISnapshotInfo info) {
+        fSnapshotInfo = info;
     }
 
+    // ------------------------------------------------------------------------
+    // Operations
+    // ------------------------------------------------------------------------
+
     @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (!super.equals(obj)) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        SessionInfo other = (SessionInfo) obj;
-        if (!fDomains.equals(other.fDomains)) {
-            return false;
-        }
-        if (fIsStreamedTrace != other.fIsStreamedTrace) {
-            return false;
-        }
-        if (fSessionPath == null) {
-            if (other.fSessionPath != null) {
-                return false;
-            }
-        } else if (!fSessionPath.equals(other.fSessionPath)) {
-            return false;
-        }
-        if (fState != other.fState) {
-            return false;
-        }
-        return true;
+    public void addDomain(IDomainInfo domainInfo) {
+        fDomains.add(domainInfo);
     }
 
+
     @SuppressWarnings("nls")
     @Override
     public String toString() {
         StringBuffer output = new StringBuffer();
             output.append("[SessionInfo(");
             output.append(super.toString());
+            output.append(",Path=");
+            output.append(getSessionPath());
             output.append(",State=");
             output.append(fState);
             output.append(",isStreamedTrace=");
             output.append(fIsStreamedTrace);
+            if (fSnapshotInfo != null) {
+                output.append(",snapshotInfo=");
+                output.append(fSnapshotInfo.toString());
+            }
             output.append(",Domains=");
             for (Iterator<IDomainInfo> iterator = fDomains.iterator(); iterator.hasNext();) {
                 IDomainInfo domain = iterator.next();
This page took 0.025072 seconds and 5 git commands to generate.