lttng: Add snapshot support - LTTng Tools v2.3
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng2.ui / src / org / eclipse / linuxtools / internal / lttng2 / ui / views / control / model / impl / TraceSessionGroup.java
index 286f6e3d9a91622ecf1d54bf8f770b1549f9d63d..66c151edbf2af59ff5cdb61d246a8da591a949a8 100644 (file)
@@ -1,13 +1,14 @@
 /**********************************************************************
- * Copyright (c) 2012 Ericsson
- * 
+ * Copyright (c) 2012, 2013 Ericsson
+ *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
  * accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors: 
+ *
+ * Contributors:
  *   Bernd Hufmann - Initial API and implementation
+ *   Bernd Hufmann - Updated for support of LTTng Tools 2.1
  **********************************************************************/
 package org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl;
 
@@ -18,10 +19,11 @@ import org.eclipse.linuxtools.internal.lttng2.core.control.model.ISessionInfo;
 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponent;
 
 /**
- * <b><u>TraceSessionGroup</u></b>
  * <p>
  * Implementation of the trace session group.
  * </p>
+ *
+ * @author Bernd Hufmann
  */
 public class TraceSessionGroup extends TraceControlComponent {
     // ------------------------------------------------------------------------
@@ -29,21 +31,21 @@ public class TraceSessionGroup extends TraceControlComponent {
     // ------------------------------------------------------------------------
     /**
      * Path to icon file for this component.
-     */    
+     */
     public static final String TRACE_SESSIONS_ICON_FILE = "icons/obj16/sessions.gif"; //$NON-NLS-1$
-    
+
     // ------------------------------------------------------------------------
     // Attributes
     // ------------------------------------------------------------------------
-    
+
     // ------------------------------------------------------------------------
     // Constructors
     // ------------------------------------------------------------------------
     /**
-     * Constructor 
+     * Constructor
      * @param name - the name of the component.
      * @param parent - the parent of this component.
-     */    
+     */
     public TraceSessionGroup(String name, ITraceControlComponent parent) {
         super(name, parent);
         setImage(TRACE_SESSIONS_ICON_FILE);
@@ -60,12 +62,29 @@ public class TraceSessionGroup extends TraceControlComponent {
         return (TargetNodeComponent)getParent();
     }
 
+    /**
+     * Returns if node supports networks streaming or not
+     * @return <code>true</code> if node supports filtering else <code>false</code>
+     */
+    public boolean isNetworkStreamingSupported() {
+        return getTargetNode().isNetworkStreamingSupported();
+    }
+    /**
+     * Returns if node supports snapshots or not
+     * @return <code>true</code> if it supports snapshots else <code>false</code>
+     *
+     */    public boolean isSnapshotSupported() {
+        return getTargetNode().isSnapshotSupported();
+    }
+
     // ------------------------------------------------------------------------
     // Operations
     // ------------------------------------------------------------------------
     /**
      * Retrieves the sessions information from the node.
+     *
      * @throws ExecutionException
+     *             If the command fails
      */
     public void getSessionsFromNode() throws ExecutionException {
         getSessionsFromNode(new NullProgressMonitor());
@@ -73,39 +92,70 @@ public class TraceSessionGroup extends TraceControlComponent {
 
     /**
      * Retrieves the sessions information from the node.
-     * @param monitor - a progress monitor
+     *
+     * @param monitor
+     *            - a progress monitor
      * @throws ExecutionException
+     *             If the command fails
      */
-    public void getSessionsFromNode(IProgressMonitor monitor) throws ExecutionException {
+    public void getSessionsFromNode(IProgressMonitor monitor)
+            throws ExecutionException {
         String[] sessionNames = getControlService().getSessionNames(monitor);
         for (int i = 0; i < sessionNames.length; i++) {
-            TraceSessionComponent session = new TraceSessionComponent(sessionNames[i], this);
+            TraceSessionComponent session = new TraceSessionComponent(
+                    sessionNames[i], this);
             addChild(session);
             session.getConfigurationFromNode(monitor);
         }
     }
 
     /**
-     * Creates a session with given session name and location. 
-     * @param sessionName - a session name to create
-     * @param sessionPath - a path for storing the traces (use null for default)
-     * @return the session information
-     * throws ExecutionExecption
+     * Creates a session with given session name and location.
+     *
+     * @param sessionName
+     *            - a session name to create
+     * @param sessionPath
+     *            - a path for storing the traces (use null for default)
+     * @param isSnapshot
+     *            - true for snapshot session else false
+     * @param monitor
+     *            - a progress monitor
+     * @throws ExecutionException
+     *             If the command fails
      */
-    public void createSession(String sessionName, String sessionPath) throws ExecutionException {
-        createSession(sessionName, sessionPath, new NullProgressMonitor());
+    public void createSession(String sessionName, String sessionPath, boolean isSnapshot, IProgressMonitor monitor) throws ExecutionException {
+        ISessionInfo sessionInfo = getControlService().createSession(sessionName, sessionPath, isSnapshot, monitor);
+
+        if (sessionInfo != null) {
+            TraceSessionComponent session = new TraceSessionComponent(
+                    sessionInfo.getName(), TraceSessionGroup.this);
+            addChild(session);
+            session.getConfigurationFromNode(monitor);
+        }
     }
-    
+
     /**
-     * Creates a session with given session name and location. 
-     * @param sessionName - a session name to create
-     * @param sessionPath - a path for storing the traces (use null for default)
-     * @Param monitor - a progress monitor 
-     * @return the session information
-     * throws ExecutionExecption
+     * Creates a session with given session name and location.
+     *
+     * @param sessionName
+     *            - a session name to create
+     * @param networkUrl
+     *            - a network URL for common definition of data and control channel
+     *              or null if separate definition of data and control channel
+     * @param controlUrl
+     *            - a URL for control channel (networkUrl has to be null, dataUrl has to be set)
+     * @param dataUrl
+     *            - a URL for data channel (networkUrl has to be null, controlUrl has to be set)
+     * @param isSnapshot
+     *            - true for snapshot session else false
+     * @param monitor
+     *            - a progress monitor
+     * @throws ExecutionException
+     *             If the command fails
      */
-    public void createSession(String sessionName, String sessionPath, IProgressMonitor monitor) throws ExecutionException {
-        ISessionInfo sessionInfo = getControlService().createSession(sessionName, sessionPath, monitor);
+    public void createSession(String sessionName, String networkUrl, String controlUrl, String dataUrl, boolean isSnapshot, IProgressMonitor monitor) throws ExecutionException {
+        ISessionInfo sessionInfo = getControlService().createSession(sessionName, networkUrl, controlUrl, dataUrl, isSnapshot, monitor);
+
         if (sessionInfo != null) {
             TraceSessionComponent session = new TraceSessionComponent(sessionInfo.getName(), TraceSessionGroup.this);
             addChild(session);
@@ -114,21 +164,17 @@ public class TraceSessionGroup extends TraceControlComponent {
     }
 
     /**
-     * Destroys a session with given session name. 
-     * @param session - a session component to destroy
-     * throws ExecutionExecption
-     */
-    public void destroySession(TraceSessionComponent session) throws ExecutionException {
-        destroySession(session, new NullProgressMonitor());
-    }
-    
-    /**
-     * Destroys a session with given session name. 
-     * @param session - a session component to destroy
-     * @param monitor - a progress monitor
-     * throws ExecutionExecption
+     * Destroys a session with given session name.
+     *
+     * @param session
+     *            - a session component to destroy
+     * @param monitor
+     *            - a progress monitor
+     * @throws ExecutionException
+     *             If the command fails
      */
-    public void destroySession(TraceSessionComponent session, IProgressMonitor monitor) throws ExecutionException {
+    public void destroySession(TraceSessionComponent session,
+            IProgressMonitor monitor) throws ExecutionException {
         getControlService().destroySession(session.getName(), monitor);
         session.removeAllChildren();
         removeChild(session);
This page took 0.02651 seconds and 5 git commands to generate.