control: Add support for saving session
[deliverable/tracecompass.git] / lttng / org.eclipse.tracecompass.lttng2.control.ui / src / org / eclipse / tracecompass / internal / lttng2 / control / ui / views / service / LTTngControlService.java
index 7fd436453b36940f14bf5b1d8e2c41fdf6f87c92..e531a4a21dd4d373ec4497c575bde16f26d25ef8 100644 (file)
@@ -668,16 +668,6 @@ public class LTTngControlService implements ILttngControlService {
 
     }
 
-    @Override
-    public void loadSession(String sessionPath, IProgressMonitor monitor) throws ExecutionException {
-
-        ICommandInput command = createCommand(LTTngControlServiceConstants.COMMAND_LOAD_SESSION, "-i", sessionPath); //$NON-NLS-1$
-
-        executeCommand(command, monitor);
-
-        // Session <sessionName> loaded
-    }
-
     @Override
     public void enableChannels(String sessionName, List<String> channelNames, boolean isKernel, IChannelInfo info, IProgressMonitor monitor) throws ExecutionException {
 
@@ -1030,6 +1020,41 @@ public class LTTngControlService implements ILttngControlService {
         executeCommand(command, monitor);
     }
 
+    @Override
+    public void loadSession(String inputPath, boolean isForce, IProgressMonitor monitor)
+            throws ExecutionException {
+        ICommandInput command = createCommand(LTTngControlServiceConstants.COMMAND_LOAD_SESSION);
+
+        if (inputPath != null) {
+            command.add(LTTngControlServiceConstants.OPTION_INPUT_PATH);
+            command.add(inputPath);
+        }
+
+        if (isForce) {
+            command.add(LTTngControlServiceConstants.OPTION_FORCE);
+        }
+        executeCommand(command, monitor);
+    }
+
+    @Override
+    public void saveSession(String session, String outputPath, boolean isForce, IProgressMonitor monitor) throws ExecutionException {
+        ICommandInput command = createCommand(LTTngControlServiceConstants.COMMAND_SAVE_SESSION);
+
+        if (outputPath != null) {
+            command.add(LTTngControlServiceConstants.OPTION_OUTPUT_PATH);
+            command.add(outputPath);
+        }
+
+        if (isForce) {
+            command.add(LTTngControlServiceConstants.OPTION_FORCE);
+        }
+
+        if (session != null) {
+            command.add(session);
+        }
+        executeCommand(command, monitor);
+    }
+
     @Override
     public void runCommands(IProgressMonitor monitor, List<String> commandLines) throws ExecutionException {
         for (String commandLine : commandLines) {
This page took 0.025067 seconds and 5 git commands to generate.