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;
/**
* 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
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();
// ------------------------------------------------------------------------
// Accessors
// ------------------------------------------------------------------------
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ISessionInfo#getSessionState()
- */
+
@Override
public TraceSessionState getSessionState() {
return fState;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ISessionInfo#setSessionState(org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.TraceSessionState)
- */
@Override
public void setSessionState(TraceSessionState state) {
fState = state;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ISessionInfo#setSessionState(java.lang.String)
- */
@Override
public void setSessionState(String stateName) {
if (TraceSessionState.INACTIVE.getInName().equals(stateName)) {
}
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ISessionInfo#getSessionPath()
- */
@Override
public String getSessionPath() {
+ if(isSnapshotSession()) {
+ return fSnapshotInfo.getSnapshotPath();
+ }
return fSessionPath;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ISessionInfo#setSessionPath(java.lang.String)
- */
@Override
public void setSessionPath(String path) {
fSessionPath = path;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ISessionInfo#getDomains()
- */
@Override
public IDomainInfo[] getDomains() {
return fDomains.toArray(new IDomainInfo[fDomains.size()]);
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ISessionInfo#setDomains(java.util.List)
- */
@Override
public void setDomains(List<IDomainInfo> domains) {
+ fDomains.clear();
for (Iterator<IDomainInfo> iterator = domains.iterator(); iterator.hasNext();) {
IDomainInfo domainInfo = iterator.next();
fDomains.add(domainInfo);
}
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.core.control.model.ISessionInfo#isStreamedTrace()
- */
@Override
public boolean isStreamedTrace() {
+ if (isSnapshotSession()) {
+ return fSnapshotInfo.isStreamedSnapshot();
+ }
return fIsStreamedTrace;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.core.control.model.ISessionInfo#setIsStreamedTrace(boolean)
- */
-
@Override
public void setStreamedTrace(boolean isStreamedTrace) {
fIsStreamedTrace = isStreamedTrace;
}
- // ------------------------------------------------------------------------
- // Operations
- // ------------------------------------------------------------------------
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ISessionInfo#addDomain(org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IDomainInfo)
- */
@Override
- public void addDomain(IDomainInfo domainInfo) {
- fDomains.add(domainInfo);
+ public boolean isSnapshotSession() {
+ return fSnapshotInfo != null;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.TraceInfo#hashCode()
- */
@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 ISnapshotInfo getSnapshotInfo() {
+ return fSnapshotInfo;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.TraceInfo#equals(java.lang.Object)
- */
@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 setSnapshotInfo(ISnapshotInfo info) {
+ fSnapshotInfo = info;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceInfo#toString()
- */
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+
+ @Override
+ 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();