aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernd Hufmann2013-02-13 11:59:09 (EST)
committerBernd Hufmann2013-02-14 10:48:05 (EST)
commit87935065452c2b470b87c01d53cc1b971787bbad (patch)
tree10f6de28d2d136e083ae738be6e88357720783d7
parent0fbc20a55eaee556591429bdc288a23c9b12424f (diff)
downloadorg.eclipse.linuxtools-87935065452c2b470b87c01d53cc1b971787bbad.zip
org.eclipse.linuxtools-87935065452c2b470b87c01d53cc1b971787bbad.tar.gz
org.eclipse.linuxtools-87935065452c2b470b87c01d53cc1b971787bbad.tar.bz2
Add support for streaming feature of LTTng Tools 2.1 (part 1)refs/changes/63/9363/6
- Add support for streaming configuration during session creation - Update import for local traces - Update JUnit tests Change-Id: I74e6a44b2bb877203b6837c657cc919feadbe65b Reviewed-on: https://git.eclipse.org/r/9363 Tested-by: Hudson CI Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com> IP-Clean: Matthew Khouzam <matthew.khouzam@ericsson.com> Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/control/model/impl/ModelImplFactory.java1
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.core/src/org/eclipse/linuxtools/internal/lttng2/core/control/model/ISessionInfo.java12
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.core/src/org/eclipse/linuxtools/internal/lttng2/core/control/model/impl/SessionInfo.java34
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlCreateSessionTests.java270
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlPropertiesTest.java2
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/service/LTTngControlServiceTest.java64
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/CreateSessionDialogStub.java64
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui.tests/testfiles/CreateSessionTest.cfg262
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui.tests/testfiles/CreateTreeTest.cfg2
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui.tests/testfiles/LTTngServiceTest.cfg95
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/CreateSessionDialog.java686
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/ICreateSessionDialog.java58
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/ImportDialog.java219
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/CreateSessionHandler.java16
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/ImportHandler.java2
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/Messages.java23
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/messages.properties28
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TargetNodeComponent.java9
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceSessionComponent.java16
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceSessionGroup.java82
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/ILttngControlService.java46
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlService.java119
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceConstants.java26
23 files changed, 1970 insertions, 166 deletions
diff --git a/lttng/org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/control/model/impl/ModelImplFactory.java b/lttng/org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/control/model/impl/ModelImplFactory.java
index 0c6e5c1..855fccd 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/control/model/impl/ModelImplFactory.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/control/model/impl/ModelImplFactory.java
@@ -134,6 +134,7 @@ public class ModelImplFactory {
fSessionInfo2.setSessionState(TraceSessionState.INACTIVE);
fSessionInfo2.addDomain(fDomainInfo1);
fSessionInfo2.addDomain(fDomainInfo2);
+ fSessionInfo2.setStreamedTrace(true);
fProbeEventInfo1 = new ProbeEventInfo("probeEvent1");
fProbeEventInfo1.setEventType(TraceEventType.TRACEPOINT);
diff --git a/lttng/org.eclipse.linuxtools.lttng2.core/src/org/eclipse/linuxtools/internal/lttng2/core/control/model/ISessionInfo.java b/lttng/org.eclipse.linuxtools.lttng2.core/src/org/eclipse/linuxtools/internal/lttng2/core/control/model/ISessionInfo.java
index dbbfb56..925151f 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.core/src/org/eclipse/linuxtools/internal/lttng2/core/control/model/ISessionInfo.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.core/src/org/eclipse/linuxtools/internal/lttng2/core/control/model/ISessionInfo.java
@@ -65,4 +65,16 @@ public interface ISessionInfo extends ITraceInfo {
* @param domainInfo domain information to add.
*/
public void addDomain(IDomainInfo domainInfo);
+
+ /**
+ * Returns if session is streamed over network
+ * @return <code>true</code> if streamed over network else <code>false</code>
+ */
+ public boolean isStreamedTrace();
+
+ /**
+ * Sets whether the trace is streamed or not
+ * @param isStreamedTrace <code>true</code> if streamed over network else <code>false</code>
+ */
+ public void setStreamedTrace(boolean isStreamedTrace);
}
diff --git a/lttng/org.eclipse.linuxtools.lttng2.core/src/org/eclipse/linuxtools/internal/lttng2/core/control/model/impl/SessionInfo.java b/lttng/org.eclipse.linuxtools.lttng2.core/src/org/eclipse/linuxtools/internal/lttng2/core/control/model/impl/SessionInfo.java
index 0878a5b..164da04 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.core/src/org/eclipse/linuxtools/internal/lttng2/core/control/model/impl/SessionInfo.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.core/src/org/eclipse/linuxtools/internal/lttng2/core/control/model/impl/SessionInfo.java
@@ -44,6 +44,10 @@ public class SessionInfo extends TraceInfo implements ISessionInfo {
* The domains information of this session.
*/
private final List<IDomainInfo> fDomains = new ArrayList<IDomainInfo>();
+ /**
+ * Flag to indicate whether trace is streamed over network or not.
+ */
+ private boolean fIsStreamedTrace = false;
// ------------------------------------------------------------------------
// Constructors
@@ -64,6 +68,7 @@ public class SessionInfo extends TraceInfo implements ISessionInfo {
super(other);
fState = other.fState;
fSessionPath = other.fSessionPath;
+ fIsStreamedTrace = other.fIsStreamedTrace;
for (Iterator<IDomainInfo> iterator = other.fDomains.iterator(); iterator.hasNext();) {
IDomainInfo domain = iterator.next();
@@ -148,6 +153,25 @@ public class SessionInfo extends TraceInfo implements ISessionInfo {
}
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.internal.lttng2.core.control.model.ISessionInfo#isStreamedTrace()
+ */
+ @Override
+ public boolean isStreamedTrace() {
+ 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
// ------------------------------------------------------------------------
@@ -162,21 +186,22 @@ public class SessionInfo extends TraceInfo implements ISessionInfo {
/*
* (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceInfo#hashCode()
+ * @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 == null) ? 0 : fDomains.hashCode());
+ result = prime * result + (fIsStreamedTrace ? 1231 : 1237);
result = prime * result + ((fSessionPath == null) ? 0 : fSessionPath.hashCode());
- result = prime * result + ((fState == null) ? 0 : (fState.ordinal() + 1));
+ result = prime * result + ((fState == null) ? 0 : fState.hashCode());
return result;
}
/*
* (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceInfo#equals(java.lang.Object)
+ * @see org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.TraceInfo#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
@@ -197,6 +222,9 @@ public class SessionInfo extends TraceInfo implements ISessionInfo {
} else if (!fDomains.equals(other.fDomains)) {
return false;
}
+ if (fIsStreamedTrace != other.fIsStreamedTrace) {
+ return false;
+ }
if (fSessionPath == null) {
if (other.fSessionPath != null) {
return false;
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlCreateSessionTests.java b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlCreateSessionTests.java
new file mode 100644
index 0000000..eb259bd
--- /dev/null
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlCreateSessionTests.java
@@ -0,0 +1,270 @@
+/**********************************************************************
+ * Copyright (c) 2012 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:
+ * Bernd Hufmann - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.linuxtools.lttng2.ui.tests.control.model.component;
+
+import java.io.File;
+import java.net.URL;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.linuxtools.internal.lttng2.core.control.model.TargetNodeState;
+import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceSessionState;
+import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.CreateSessionDialogStub;
+import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.DestroyConfirmDialogStub;
+import org.eclipse.linuxtools.internal.lttng2.stubs.service.TestRemoteSystemProxy;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.TraceControlDialogFactory;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponent;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TargetNodeComponent;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceSessionComponent;
+import org.eclipse.rse.core.RSECorePlugin;
+import org.eclipse.rse.core.model.IHost;
+import org.eclipse.rse.core.model.ISystemProfile;
+import org.eclipse.rse.core.model.ISystemRegistry;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.FrameworkUtil;
+
+/**
+ * The class <code>TraceControlKernelSessionTests</code> contains Kernel session/channel/event
+ * handling test cases.
+ */
+
+@SuppressWarnings({"nls", "javadoc"})
+public class TraceControlCreateSessionTests {
+
+ // ------------------------------------------------------------------------
+ // Constants
+ // ------------------------------------------------------------------------
+ private static final String TEST_STREAM = "CreateSessionTest.cfg";
+ private static final String SCEN_SCENARIO_NO_CONSUMER_TEST = "CreateSessionNoConsumer";
+ private static final String SCEN_SCENARIO_DISABLE_CONSUMER_TEST = "CreateSessionDisableConsumer";
+ private static final String SCEN_SCENARIO_FILE_PROTO_TEST = "CreateSessionFileProto";
+ private static final String SCEN_SCENARIO_CONTROL_DATA_TEST = "CreateSessionControlData";
+ private static final String SCEN_SCENARIO_NETWORK_TEST = "CreateSessionNetwork";
+
+ // ------------------------------------------------------------------------
+ // Test data
+ // ------------------------------------------------------------------------
+ private TraceControlTestFacility fFacility;
+ private TestRemoteSystemProxy fProxy;
+ private String fTestFile;
+
+ // ------------------------------------------------------------------------
+ // Housekeeping
+ // ------------------------------------------------------------------------
+
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws Exception
+ * if the initialization fails for some reason
+ *
+ */
+ @Before
+ public void setUp() throws Exception {
+ fFacility = TraceControlTestFacility.getInstance();
+ fProxy = new TestRemoteSystemProxy();
+ URL location = FileLocator.find(FrameworkUtil.getBundle(this.getClass()), new Path(TraceControlTestFacility.DIRECTORY + File.separator + TEST_STREAM), null);
+ File testfile = new File(FileLocator.toFileURL(location).toURI());
+ fTestFile = testfile.getAbsolutePath();
+ }
+
+ /**
+ * Perform post-test clean-up.
+ *
+ * @throws Exception
+ * if the clean-up fails for some reason
+ *
+ */
+ @After
+ public void tearDown() {
+ fFacility.waitForJobs();
+ }
+
+ /**
+ * Run the TraceControlComponent.
+ */
+ @Test
+ public void testTraceSessionTree() throws Exception {
+
+ fProxy.setTestFile(fTestFile);
+ fProxy.setScenario(TraceControlTestFacility.SCEN_INIT_TEST);
+
+ ITraceControlComponent root = TraceControlTestFacility.getInstance().getControlView().getTraceControlRoot();
+
+ ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
+ ISystemProfile profile = registry.createSystemProfile("myProfile", true);
+ IHost host = registry.createLocalHost(profile, "myProfile", "user");
+
+ TargetNodeComponent node = new TargetNodeComponent("myNode", root, host, fProxy);
+
+ root.addChild(node);
+ fFacility.waitForJobs();
+
+ fFacility.executeCommand(node, "connect");
+ int i = 0;
+ while ((i < 10) && (node.getTargetNodeState() != TargetNodeState.CONNECTED)) {
+ i++;
+ fFacility.delay(TraceControlTestFacility.GUI_REFESH_DELAY);
+ }
+
+ // Verify that node is connected
+ assertEquals(TargetNodeState.CONNECTED, node.getTargetNodeState());
+
+ // Get provider groups
+ ITraceControlComponent[] groups = node.getChildren();
+ assertNotNull(groups);
+ assertEquals(2, groups.length);
+
+ // Initialize dialog implementations for command execution
+ CreateSessionDialogStub sessionDialogStub = new CreateSessionDialogStub();
+ TraceControlDialogFactory.getInstance().setCreateSessionDialog(sessionDialogStub);
+ TraceControlDialogFactory.getInstance().setConfirmDialog(new DestroyConfirmDialogStub());
+
+ // Initialize session handling scenario
+ fProxy.setScenario(SCEN_SCENARIO_NO_CONSUMER_TEST);
+
+ // ------------------------------------------------------------------------
+ // Create session (--no-consumer) and destroy
+ // ------------------------------------------------------------------------
+ // Initialize session handling scenario
+ fProxy.setScenario(SCEN_SCENARIO_NO_CONSUMER_TEST);
+ sessionDialogStub.setNoConsumer(true);
+ TraceSessionComponent session = fFacility.createSession(groups[1]);
+
+ // Verify that session was created
+ assertNotNull(session);
+ assertEquals("mysession", session.getName());
+ assertEquals("", session.getSessionPath());
+ assertEquals(TraceSessionState.INACTIVE, session.getSessionState());
+ sessionDialogStub.setNoConsumer(false);
+
+ fFacility.destroySession(session);
+
+ // Verify that no more session components exist
+ assertEquals(0, groups[1].getChildren().length);
+
+ // ------------------------------------------------------------------------
+ // Create session (--disable-consumer) and destroy
+ // ------------------------------------------------------------------------
+ // Initialize session handling scenario
+ fProxy.setScenario(SCEN_SCENARIO_DISABLE_CONSUMER_TEST);
+
+ sessionDialogStub.setDisableConsumer(true);
+ session = fFacility.createSession(groups[1]);
+
+ // Verify that session was created
+ assertNotNull(session);
+ assertEquals("mysession", session.getName());
+ assertEquals(TraceSessionState.INACTIVE, session.getSessionState());
+ sessionDialogStub.setDisableConsumer(false);
+
+ fFacility.destroySession(session);
+
+ // Verify that no more session components exist
+ assertEquals(0, groups[1].getChildren().length);
+
+ // ------------------------------------------------------------------------
+ // Create session (--U file://...) and destroy
+ // ------------------------------------------------------------------------
+ // Initialize session handling scenario
+ fProxy.setScenario(SCEN_SCENARIO_FILE_PROTO_TEST);
+
+ sessionDialogStub.setNetworkUrl("file:///tmp");
+ sessionDialogStub.setStreamedTrace(true);
+ session = fFacility.createSession(groups[1]);
+
+ // Verify that session was created
+ assertNotNull(session);
+ assertEquals("mysession", session.getName());
+ assertEquals("file:///tmp", session.getSessionPath());
+ assertTrue(session.isStreamedTrace());
+ assertEquals(TraceSessionState.INACTIVE, session.getSessionState());
+ sessionDialogStub.setNetworkUrl(null);
+ sessionDialogStub.setStreamedTrace(false);
+
+ fFacility.destroySession(session);
+
+ // Verify that no more session components exist
+ assertEquals(0, groups[1].getChildren().length);
+
+ // ------------------------------------------------------------------------
+ // Create session (--U file://,,, and destroy
+ // ------------------------------------------------------------------------
+ // Initialize session handling scenario
+ fProxy.setScenario(SCEN_SCENARIO_CONTROL_DATA_TEST);
+
+ sessionDialogStub.setControlUrl("tcp://172.0.0.1");
+ sessionDialogStub.setDataUrl("tcp://172.0.0.1:5343");
+ sessionDialogStub.setStreamedTrace(true);
+
+ session = fFacility.createSession(groups[1]);
+
+ // Verify that session was created
+ assertNotNull(session);
+ assertEquals("mysession", session.getName());
+ assertEquals("tcp://172.0.0.1:5342 [data: 5343]", session.getSessionPath());
+ assertTrue(session.isStreamedTrace());
+ assertEquals(TraceSessionState.INACTIVE, session.getSessionState());
+ sessionDialogStub.setControlUrl(null);
+ sessionDialogStub.setDataUrl(null);
+ sessionDialogStub.setStreamedTrace(false);
+
+ fFacility.destroySession(session);
+
+ // Verify that no more session components exist
+ assertEquals(0, groups[1].getChildren().length);
+
+ // ------------------------------------------------------------------------
+ // Create session (--U file://,,, and destroy
+ // ------------------------------------------------------------------------
+ // Initialize session handling scenario
+ fProxy.setScenario(SCEN_SCENARIO_NETWORK_TEST);
+
+ sessionDialogStub.setNetworkUrl("net://172.0.0.1:1234:2345");
+ sessionDialogStub.setStreamedTrace(true);
+
+ session = fFacility.createSession(groups[1]);
+
+ // Verify that session was created
+ assertNotNull(session);
+ assertEquals("mysession", session.getName());
+ assertEquals("net://172.0.0.1:1234 [data: 2345]", session.getSessionPath());
+ assertTrue(session.isStreamedTrace());
+ assertEquals(TraceSessionState.INACTIVE, session.getSessionState());
+ sessionDialogStub.setNetworkUrl(null);
+
+ fFacility.destroySession(session);
+
+ // Verify that no more session components exist
+ assertEquals(0, groups[1].getChildren().length);
+
+ //-------------------------------------------------------------------------
+ // Disconnect node
+ //-------------------------------------------------------------------------
+ fFacility.executeCommand(node, "disconnect");
+ assertEquals(TargetNodeState.DISCONNECTED, node.getTargetNodeState());
+
+ //-------------------------------------------------------------------------
+ // Delete node
+ //-------------------------------------------------------------------------
+
+ fFacility.executeCommand(node, "delete");
+ assertEquals(0,fFacility.getControlView().getTraceControlRoot().getChildren().length);
+ }
+
+} \ No newline at end of file
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlPropertiesTest.java b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlPropertiesTest.java
index 15b1984..52f35ab 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlPropertiesTest.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlPropertiesTest.java
@@ -338,4 +338,4 @@ public class TraceControlPropertiesTest {
node.disconnect();
node.getParent().removeChild(node);
}
-} \ No newline at end of file
+}
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/service/LTTngControlServiceTest.java b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/service/LTTngControlServiceTest.java
index d13c2ec..035b4fe 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/service/LTTngControlServiceTest.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/service/LTTngControlServiceTest.java
@@ -83,6 +83,7 @@ public class LTTngControlServiceTest {
private static final String SCEN_CONTEXT_HANDLING = "ContextHandling";
private static final String SCEN_CONTEXT_ERROR_HANDLING = "ContextErrorHandling";
private static final String SCEN_CALIBRATE_HANDLING = "CalibrateHandling";
+ private static final String SCEN_CREATE_SESSION_2_1 = "CreateSessionLttng2.1";
// ------------------------------------------------------------------------
// Test data
@@ -948,4 +949,67 @@ public class LTTngControlServiceTest {
}
}
+ public void testCreateSession2_1() {
+
+ try {
+ fShell.setScenario(SCEN_CREATE_SESSION_2_1);
+
+ ISessionInfo info = fService.createSession("mysession", null, true, false, new NullProgressMonitor());
+ assertNotNull(info);
+ assertEquals("mysession", info.getName());
+ assertEquals("", info.getSessionPath());
+ fService.destroySession("mysession", new NullProgressMonitor());
+
+ info = fService.createSession("mysession", "file:///tmp", null, null, true, false, new NullProgressMonitor());
+ assertNotNull(info);
+ assertEquals("mysession", info.getName());
+ assertEquals("", info.getSessionPath());
+ assertTrue(info.isStreamedTrace());
+ fService.destroySession("mysession", new NullProgressMonitor());
+
+ info = fService.createSession("mysession", "net://172.0.0.1", null, null, false, true, new NullProgressMonitor());
+ assertNotNull(info);
+ assertEquals("mysession", info.getName());
+ assertEquals("net://172.0.0.1", info.getSessionPath());
+ assertTrue(info.isStreamedTrace());
+ fService.destroySession("mysession", new NullProgressMonitor());
+
+ info = fService.createSession("mysession", null, false, true, new NullProgressMonitor());
+ assertNotNull(info);
+ assertEquals("mysession", info.getName());
+ // >>> no way to verify provided by tracer!!!
+ fService.destroySession("mysession", new NullProgressMonitor());
+
+ info = fService.createSession("mysession", "file:///tmp", null, null, false, false, new NullProgressMonitor());
+ assertNotNull(info);
+ assertEquals("mysession", info.getName());
+ assertEquals("file:///tmp", info.getSessionPath());
+ assertTrue(info.isStreamedTrace());
+ fService.destroySession("mysession", new NullProgressMonitor());
+
+ info = fService.createSession("mysession", "file:///tmp", null, null, false, false, new NullProgressMonitor());
+ assertNotNull(info);
+ assertEquals("mysession", info.getName());
+ assertEquals("file:///tmp", info.getSessionPath());
+ assertTrue(info.isStreamedTrace());
+ fService.destroySession("mysession", new NullProgressMonitor());
+
+ info = fService.createSession("mysession", null, "tcp://172.0.0.1", "tcp://172.0.0.1:5343", false, false, new NullProgressMonitor());
+ assertNotNull(info);
+ assertEquals("mysession", info.getName());
+ assertEquals("", info.getSessionPath()); // TODO: currently there is a bug in LTTng tracer and it returns string null
+ assertTrue(info.isStreamedTrace());
+ fService.destroySession("mysession", new NullProgressMonitor());
+
+ info = fService.createSession("mysession", "net://172.0.0.1:1234:2345", null, null, false, false, new NullProgressMonitor());
+ assertNotNull(info);
+ assertEquals("mysession", info.getName());
+ assertEquals("net://172.0.0.1:1234:2345", info.getSessionPath());
+ assertTrue(info.isStreamedTrace());
+ fService.destroySession("mysession", new NullProgressMonitor());
+
+ } catch (ExecutionException e) {
+ fail(e.toString());
+ }
+ }
}
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/CreateSessionDialogStub.java b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/CreateSessionDialogStub.java
index 88757c7..d8b9cfd 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/CreateSessionDialogStub.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/CreateSessionDialogStub.java
@@ -22,7 +22,12 @@ public class CreateSessionDialogStub implements ICreateSessionDialog {
public String fName = "mysession"; //$NON-NLS-1$
public String fPath = null;
-
+ private boolean fIsStreamedTrace = false;
+ private String fNetworkUrl = null;
+ private String fControlUrl = null;
+ private String fDataUrl = null;
+ private boolean fIsNoConsumer = false;
+ private boolean fIsDisableConsumer = false;
@Override
public String getSessionName() {
@@ -40,8 +45,7 @@ public class CreateSessionDialogStub implements ICreateSessionDialog {
}
@Override
- public void setTraceSessionGroup(TraceSessionGroup group) {
-
+ public void initialize(TraceSessionGroup group) {
}
@Override
@@ -56,4 +60,58 @@ public class CreateSessionDialogStub implements ICreateSessionDialog {
public void setSessionName(String name) {
fName = name;
}
+
+ @Override
+ public boolean isStreamedTrace() {
+ return fIsStreamedTrace;
+ }
+
+ public void setStreamedTrace(boolean isStreamedTrace) {
+ fIsStreamedTrace = isStreamedTrace;
+ }
+
+ @Override
+ public String getNetworkUrl() {
+ return fNetworkUrl;
+ }
+
+ public void setNetworkUrl(String fNetworkUrl) {
+ this.fNetworkUrl = fNetworkUrl;
+ }
+
+
+ @Override
+ public String getControlUrl() {
+ return fControlUrl;
+ }
+
+ public void setControlUrl(String fControlUrl) {
+ this.fControlUrl = fControlUrl;
+ }
+
+ @Override
+ public String getDataUrl() {
+ return fDataUrl;
+ }
+
+ public void setDataUrl(String fDataUrl) {
+ this.fDataUrl = fDataUrl;
+ }
+
+ @Override
+ public boolean isNoConsumer() {
+ return fIsNoConsumer;
+ }
+ public void setNoConsumer(boolean isNoConsumer) {
+ fIsNoConsumer = isNoConsumer;
+ }
+
+ @Override
+ public boolean isDisableConsumer() {
+ return fIsDisableConsumer;
+ }
+
+ public void setDisableConsumer(boolean isDisableConsumer) {
+ fIsDisableConsumer = isDisableConsumer;
+ }
}
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui.tests/testfiles/CreateSessionTest.cfg b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/testfiles/CreateSessionTest.cfg
new file mode 100644
index 0000000..e0d79d1
--- /dev/null
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/testfiles/CreateSessionTest.cfg
@@ -0,0 +1,262 @@
+####################################################################
+# Copyright (c) 2012 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:
+# Bernd Hufmann - Initial API and implementation
+####################################################################
+####################################################################
+# Scenario: Initialize
+####################################################################
+<SCENARIO>
+Initialize
+<COMMAND_INPUT>
+lttng version
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+lttng version 2.0.0 - Annedd'ale
+Web site: http://lttng.org/
+
+lttng is free software and under the GPL license and part LGPL
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng list
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Currently no available tracing session
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng list -k
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Kernel events
+-------------
+ sched_kthread_stop (loglevel: TRACE_EMERG (0)) (type: tracepoint)
+ sched_kthread_stop_ret (loglevel: TRACE_EMERG (0)) (type: tracepoint)
+ sched_wakeup_new (loglevel: TRACE_EMERG (0)) (type: tracepoint)
+
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng list -u
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+UST events:
+-------------
+
+PID: 9379 - Name: /home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello
+ ust_tests_hello:tptest_sighandler (loglevel: TRACE_WARNING (4)) (type: tracepoint)
+ ust_tests_hello:tptest (loglevel: TRACE_DEBUG_FUNCTION (12)) (type: tracepoint)
+
+PID: 4852 - Name: /home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello
+ ust_tests_hello:tptest_sighandler (loglevel: TRACE_WARNING (4)) (type: tracepoint)
+ ust_tests_hello:tptest (loglevel: TRACE_DEBUG_FUNCTION (12)) (type: tracepoint)
+
+</COMMAND_OUTPUT>
+</SCENARIO>
+
+####################################################################
+# Scenario: Test "lttng create <session> with LTTng 2.1 options
+####################################################################
+<SCENARIO>
+CreateSessionNoConsumer
+<COMMAND_INPUT>
+lttng create mysession --no-consumer
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Session mysession created.
+Traces will be written in
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng list mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Tracing session mysession: [inactive]
+ Trace path:
+
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng destroy mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Session mysession destroyed.
+</COMMAND_OUTPUT>
+</SCENARIO>
+##################################################################
+<SCENARIO>
+CreateSessionDisableConsumer
+<COMMAND_INPUT>
+lttng create mysession --disable-consumer
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Session mysession created.
+Traces will be written in /home/user/lttng-traces/mysession-20120209-095418
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng list mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Tracing session mysession: [inactive]
+ Trace path: /home/user/lttng-traces/mysession-20120209-095418
+
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng destroy mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Session mysession destroyed.
+</COMMAND_OUTPUT>
+</SCENARIO>
+
+##################################################################
+<SCENARIO>
+CreateSessionFileProto
+<COMMAND_INPUT>
+lttng create mysession -U file:///tmp
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Session mysession created.
+Traces will be written in file:///tmp
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng list mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Tracing session mysession: [inactive]
+ Trace path: file:///tmp
+
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng destroy mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Session mysession destroyed.
+</COMMAND_OUTPUT>
+</SCENARIO>
+
+##################################################################
+<SCENARIO>
+CreateSessionControlData
+<COMMAND_INPUT>
+lttng create mysession -C tcp://172.0.0.1 -D tcp://172.0.0.1:5343
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Session mysession created.
+Control URL tcp://172.0.0.1 set for session mysession
+Data URL tcp://172.0.0.1:5343 set for session mysession
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng list mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Tracing session mysession: [inactive]
+ Trace path: tcp://172.0.0.1:5342 [data: 5343]
+
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng destroy mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Session mysession destroyed.
+</COMMAND_OUTPUT>
+</SCENARIO>
+
+##################################################################
+<SCENARIO>
+CreateSessionNetwork
+<COMMAND_INPUT>
+lttng create mysession -U net://172.0.0.1:1234:2345
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Session mysession created.
+Traces will be written in net://172.0.0.1:1234:2345
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng list mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Tracing session mysession: [inactive]
+ Trace path: net://172.0.0.1:1234 [data: 2345]
+
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng destroy mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Session mysession2 destroyed.
+</COMMAND_OUTPUT>
+
+</SCENARIO> \ No newline at end of file
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui.tests/testfiles/CreateTreeTest.cfg b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/testfiles/CreateTreeTest.cfg
index 09d7c90..79b1868 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui.tests/testfiles/CreateTreeTest.cfg
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/testfiles/CreateTreeTest.cfg
@@ -10,7 +10,7 @@
# Bernd Hufmann - Initial API and implementation
####################################################################
####################################################################
-# Scenario: Test no sessions available
+# Scenario: Initialize
####################################################################
<SCENARIO>
Initialize
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui.tests/testfiles/LTTngServiceTest.cfg b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/testfiles/LTTngServiceTest.cfg
index dece427..fc6a15d 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui.tests/testfiles/LTTngServiceTest.cfg
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/testfiles/LTTngServiceTest.cfg
@@ -840,3 +840,98 @@ Kernel calibration done
</COMMAND_OUTPUT>
</SCENARIO>
+
+####################################################################
+# Scenario: Test "lttng create <session> with LTTng 2.1 options
+####################################################################
+<SCENARIO>
+CreateSessionLttng2.1
+<COMMAND_INPUT>
+lttng create mysession --no-consumer
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Session mysession created.
+Traces will be written in
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng create mysession -U file:///tmp --no-consumer
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Session mysession created.
+Traces will be written in
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng destroy mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Session mysession destroyed.
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng create mysession --disable-consumer
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Session mysession created.
+Traces will be written in /home/user/lttng-traces/mysession-20120209-095418
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng create mysession -U net://172.0.0.1 --disable-consumer
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Session mysession created.
+Traces will be written in net://172.0.0.1
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng create mysession -U file:///tmp
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Session mysession created.
+Traces will be written in file:///tmp
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng create mysession -C tcp://172.0.0.1 -D tcp://172.0.0.1:5343
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Session mysession created.
+Control URL tcp://172.0.0.1 set for session mysession
+Data URL tcp://172.0.0.1:5343 set for session mysession
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng create mysession -U net://172.0.0.1:1234:2345
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Session mysession created.
+Traces will be written in net://172.0.0.1:1234:2345
+</COMMAND_OUTPUT>
+
+</SCENARIO>
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/CreateSessionDialog.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/CreateSessionDialog.java
index 11e8005..81a4751 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/CreateSessionDialog.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/CreateSessionDialog.java
@@ -1,12 +1,12 @@
/**********************************************************************
* Copyright (c) 2012 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
**********************************************************************/
package org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs;
@@ -24,11 +24,19 @@ import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSystem;
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
@@ -37,7 +45,7 @@ import org.eclipse.swt.widgets.Text;
* <p>
* Dialog box for collecting session creation information.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class CreateSessionDialog extends Dialog implements ICreateSessionDialog {
@@ -48,11 +56,44 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog
/**
* The icon file for this dialog box.
*/
- public static final String CREATE_SESSION_ICON_FILE = "icons/elcl16/add_button.gif"; //$NON-NLS-1$
+ public static final String CREATE_SESSION_ICON_FILE = "icons/elcl16/add_button.gif"; //$NON-NLS-1$
+
+ /**
+ * Supported network protocols for streaming
+ */
+ private enum StreamingProtocol {
+ /** Default network protocol for IPv4 (TCP)*/
+ net,
+ /** Default network protocol for IPv6 (TCP)*/
+ net6,
+ /** File */
+ file,
+ }
+
+ private enum StreamingProtocol2 {
+ /** Default network protocol for IPv4 (TCP)*/
+ net,
+ /** Default network protocol for IPv6 (TCP)*/
+ net6,
+ /** TCP network protocol for IPv4*/
+ tcp,
+ /** TCP network protocol for IPv6*/
+ tcp6 }
+
+ /**
+ * Index of last supported streaming protocol for common URL configuration.
+ */
+ private final static int COMMON_URL_LAST_INDEX = 1;
+ /**
+ * Index of default streaming protocol.
+ */
+ private final static int DEFAULT_URL_INDEX = 0;
// ------------------------------------------------------------------------
// Attributes
// ------------------------------------------------------------------------
+
+ private Control fControl = null;
/**
* The dialog composite.
*/
@@ -62,10 +103,70 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog
*/
private Text fSessionNameText = null;
/**
- * The text widget for the session path
+ * The text widget for the session path.
*/
private Text fSessionPathText = null;
/**
+ * The Group for stream configuration.
+ */
+ private Group fMainStreamingGroup = null;
+ /**
+ * The button to show streaming options.
+ */
+ private Button fConfigureStreamingButton = null;
+ /**
+ * The composite with streaming configuration parameter.
+ */
+ private Composite fStreamingComposite = null;
+ /**
+ * The button to link data protocol/Address with control protocol.
+ */
+ private Button fLinkDataWithControlButton = null;
+ /**
+ * The Combo box for channel protocol selection.
+ */
+ private CCombo fControlProtocolCombo = null;
+ /**
+ * A selection listener that copies the protocol from control to data when being linked.
+ */
+ private ControlProtocolSelectionListener fCopyProtocolSelectionListener;
+
+ private ProtocolComboSelectionListener fControlProtocolSelectionListener;
+ private ProtocolComboSelectionListener fDataProtocolSelectionListener;
+
+ /**
+ * The text box for the host/IP address of the control channel.
+ */
+ private Text fControlHostAddressText = null;
+ /**
+ * A key listener that copies the host address from control to data when being linked.
+ */
+ private CopyKeyListener fControlUrlKeyListener;
+ /**
+ * The text box for the control port.
+ */
+ private Text fControlPortText = null;
+ /**
+ * The Combo box for data protocol selection.
+ */
+ private CCombo fDataProtocolCombo = null;
+ /**
+ * The text box for the host/IP address of the data channel.
+ */
+ private Text fDataHostAddressText = null;
+ /**
+ * The text box for the data port.
+ */
+ private Text fDataPortText = null;
+ /**
+ * The button to not activate a consumer.
+ */
+ private Button fNoConsumerButton = null;
+ /**
+ * The button to disable the consumer.
+ */
+ private Button fDisableConsumerButton = null;
+ /**
* The parent where the new node should be added.
*/
private TraceSessionGroup fParent = null;
@@ -81,6 +182,33 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog
* Flag whether default location (path) shall be used or not
*/
private boolean fIsDefaultPath = true;
+ /**
+ * Flag whether the trace is streamed or not
+ */
+ private boolean fIsStreamedTrace = false;
+ /**
+ * The network URL in case control and data is configured together.
+ * If set, fControlUrl and fDataUrl will be null.
+ */
+ private String fNetworkUrl = null;
+ /**
+ * The control URL in case control and data is configured separately.
+ * If set, fDataUrl will be set too and fNetworkUrl will be null.
+ */
+ private String fControlUrl = null;
+ /**
+ * The data URL in case control and data is configured separately.
+ * If set, fControlUrl will be set too and fNetworkUrl will be null.
+ */
+ private String fDataUrl = null;
+ /**
+ * Flag for not activating a consumer for this session.
+ */
+ private boolean fIsNoConsumer = false;
+ /**
+ * Flag for disabling a consumer for this session.
+ */
+ private boolean fIsDisableConsumer = false;
// ------------------------------------------------------------------------
// Constructors
@@ -114,7 +242,7 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog
public String getSessionPath() {
return fSessionPath;
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.ICreateSessionDialog#isDefaultSessionPath()
@@ -126,16 +254,69 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog
/*
* (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.ICreateSessionDialog#setTraceSessionGroup(org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceSessionGroup)
+ * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.ICreateSessionDialog#initialze(org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceSessionGroup)
*/
@Override
- public void setTraceSessionGroup(TraceSessionGroup group) {
- fParent = group;
+ public void initialize(TraceSessionGroup group) {
+ fParent = group;
+ fStreamingComposite = null;
+ fSessionName = null;
+ fSessionPath = null;
+ fIsDefaultPath = true;
+ fIsStreamedTrace = false;
+ fNetworkUrl = null;
+ fControlUrl = null;
+ fDataUrl = null;
+ fIsNoConsumer = false;
+ fIsDisableConsumer = false;
+ }
+
+ @Override
+ public boolean isStreamedTrace() {
+ return fIsStreamedTrace;
+ }
+ @Override
+ public String getNetworkUrl() {
+ return fNetworkUrl;
+ }
+ @Override
+ public String getControlUrl() {
+ return fControlUrl;
+ }
+ @Override
+ public String getDataUrl() {
+ return fDataUrl;
+ }
+
+ @Override
+ public boolean isNoConsumer() {
+ return fIsNoConsumer;
+ }
+
+ @Override
+ public boolean isDisableConsumer() {
+ return fIsDisableConsumer;
}
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#createContents(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected Control createContents(Composite parent) {
+ fControl = super.createContents(parent);
+
+ /* set the shell minimum size */
+ Point clientArea = fControl.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ Rectangle trim = getShell().computeTrim(0, 0, clientArea.x, clientArea.y);
+ getShell().setMinimumSize(trim.width, trim.height);
+
+ return fControl;
+ }
/*
* (non-Javadoc)
* @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
@@ -153,35 +334,326 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog
*/
@Override
protected Control createDialogArea(Composite parent) {
-
+
// Main dialog panel
fDialogComposite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout(4, true);
+ GridLayout layout = new GridLayout(1, true);
fDialogComposite.setLayout(layout);
fDialogComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
- Label sessionNameLabel = new Label(fDialogComposite, SWT.RIGHT);
+ Group sessionGroup = new Group(fDialogComposite, SWT.SHADOW_NONE);
+ sessionGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ sessionGroup.setLayout(new GridLayout(4, true));
+
+ Label sessionNameLabel = new Label(sessionGroup, SWT.RIGHT);
sessionNameLabel.setText(Messages.TraceControl_CreateSessionNameLabel);
- fSessionNameText = new Text(fDialogComposite, SWT.NONE);
+ fSessionNameText = new Text(sessionGroup, SWT.NONE);
fSessionNameText.setToolTipText(Messages.TraceControl_CreateSessionNameTooltip);
-
- Label sessionPath = new Label(fDialogComposite, SWT.RIGHT);
+
+ Label sessionPath = new Label(sessionGroup, SWT.RIGHT);
sessionPath.setText(Messages.TraceControl_CreateSessionPathLabel);
- fSessionPathText = new Text(fDialogComposite, SWT.NONE);
+ fSessionPathText = new Text(sessionGroup, SWT.NONE);
fSessionPathText.setToolTipText(Messages.TraceControl_CreateSessionPathTooltip);
// layout widgets
GridData data = new GridData(GridData.FILL_HORIZONTAL);
data.horizontalSpan = 3;
-
+
fSessionNameText.setLayoutData(data);
+
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.horizontalSpan = 3;
fSessionPathText.setLayoutData(data);
- getShell().setMinimumSize(new Point(300, 150));
-
+ if (fParent.isNetworkStreamingSupported()) {
+ fNoConsumerButton = new Button(sessionGroup, SWT.CHECK);
+ fNoConsumerButton.setText(Messages.TraceControl_CreateSessionNoConsumertText);
+ fNoConsumerButton.setToolTipText(Messages.TraceControl_CreateSessionNoConsumertTooltip);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.horizontalSpan = 2;
+ fNoConsumerButton.setLayoutData(data);
+
+ fDisableConsumerButton = new Button(sessionGroup, SWT.CHECK);
+ fDisableConsumerButton.setText(Messages.TraceControl_CreateSessionDisableConsumertText);
+ fDisableConsumerButton.setToolTipText(Messages.TraceControl_CreateSessionDisableConsumertTooltip);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.horizontalSpan = 2;
+ fDisableConsumerButton.setLayoutData(data);
+
+ fNoConsumerButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (fNoConsumerButton.getSelection()) {
+ fDisableConsumerButton.setSelection(false);
+ }
+ }
+ });
+
+ fDisableConsumerButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (fDisableConsumerButton.getSelection()) {
+ fNoConsumerButton.setSelection(false);
+ }
+ }
+ });
+
+ createAdvancedOptionsComposite();
+ }
+
return fDialogComposite;
}
+ private void createAdvancedOptionsComposite() {
+
+ fMainStreamingGroup = new Group(fDialogComposite, SWT.SHADOW_NONE);
+ fMainStreamingGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
+ fMainStreamingGroup.setLayout(new GridLayout(1, true));
+
+ fConfigureStreamingButton = new Button(fMainStreamingGroup, SWT.PUSH);
+ fConfigureStreamingButton.setText(">>> " + Messages.TraceControl_CreateSessionConfigureStreamingButtonText); //$NON-NLS-1$
+ fConfigureStreamingButton.setToolTipText(Messages.TraceControl_CreateSessionConfigureStreamingButtonTooltip);
+ fConfigureStreamingButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (fIsStreamedTrace) {
+ fIsStreamedTrace = false;
+ fConfigureStreamingButton.setText(">>> " + Messages.TraceControl_CreateSessionConfigureStreamingButtonText); //$NON-NLS-1$
+ fConfigureStreamingButton.setToolTipText(Messages.TraceControl_CreateSessionConfigureStreamingButtonTooltip);
+ disposeConfigureStreamingComposite();
+ } else {
+ fIsStreamedTrace = true;
+ fConfigureStreamingButton.setText("<<< " + Messages.TraceControl_CreateSessionNoStreamingButtonText); //$NON-NLS-1$
+ fConfigureStreamingButton.setToolTipText(Messages.TraceControl_CreateSessionNoStreamingButtonTooltip);
+ createConfigureStreamingComposite();
+ }
+
+ fDialogComposite.layout();
+
+ Point clientArea = fControl.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ Rectangle trim = getShell().computeTrim(0, 0, clientArea.x, clientArea.y);
+ getShell().setSize(trim.width, trim.height);
+ }
+ });
+ }
+
+ private void createConfigureStreamingComposite() {
+ if (fStreamingComposite == null) {
+ fStreamingComposite = new Composite(fMainStreamingGroup, SWT.NONE);
+ GridLayout layout = new GridLayout(1, true);
+ fStreamingComposite.setLayout(layout);
+ fStreamingComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ Group urlGroup = new Group(fStreamingComposite, SWT.SHADOW_NONE);
+ layout = new GridLayout(7, true);
+ urlGroup.setLayout(layout);
+ urlGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ fLinkDataWithControlButton = new Button(urlGroup, SWT.CHECK);
+ fLinkDataWithControlButton.setText(Messages.TraceControl_CreateSessionLinkButtonText);
+ fLinkDataWithControlButton.setToolTipText(Messages.TraceControl_CreateSessionLinkButtonTooltip);
+ GridData data = new GridData(GridData.FILL_HORIZONTAL);
+ data.horizontalSpan = 7;
+ fLinkDataWithControlButton.setLayoutData(data);
+ fLinkDataWithControlButton.setSelection(true);
+
+ Label label = new Label(urlGroup, SWT.NONE);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.horizontalSpan = 1;
+ label.setLayoutData(data);
+
+ label = new Label(urlGroup, SWT.NONE);
+ label.setText(Messages.TraceControl_CreateSessionProtocolLabelText);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.horizontalSpan = 1;
+ label.setLayoutData(data);
+
+ label = new Label(urlGroup, SWT.NONE);
+ label.setText(Messages.TraceControl_CreateSessionAddressLabelText);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.horizontalSpan = 4;
+ label.setLayoutData(data);
+
+ label = new Label(urlGroup, SWT.NONE);
+ label.setText(Messages.TraceControl_CreateSessionPortLabelText);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.horizontalSpan = 1;
+ label.setLayoutData(data);
+
+ label = new Label(urlGroup, SWT.RIGHT);
+ label.setText(Messages.TraceControl_CreateSessionControlUrlLabel);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.horizontalSpan = 1;
+ label.setLayoutData(data);
+
+ fControlProtocolCombo = new CCombo(urlGroup, SWT.READ_ONLY);
+ fControlProtocolCombo.setToolTipText(Messages.TraceControl_CreateSessionCommonProtocolTooltip);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.horizontalSpan = 1;
+ fControlProtocolCombo.setLayoutData(data);
+
+ fControlHostAddressText = new Text(urlGroup, SWT.NONE);
+ fControlHostAddressText.setToolTipText(Messages.TraceControl_CreateSessionControlAddressTooltip);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.horizontalSpan = 4;
+ fControlHostAddressText.setLayoutData(data);
+
+ fControlPortText = new Text(urlGroup, SWT.NONE);
+ fControlPortText.setToolTipText(Messages.TraceControl_CreateSessionControlPortTooltip);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.horizontalSpan = 1;
+ fControlPortText.setLayoutData(data);
+
+ label = new Label(urlGroup, SWT.RIGHT);
+ label.setText(Messages.TraceControl_CreateSessionDataUrlLabel);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.horizontalSpan = 1;
+ label.setLayoutData(data);
+
+ fDataProtocolCombo = new CCombo(urlGroup, SWT.READ_ONLY);
+ fDataProtocolCombo.setEnabled(false);
+ fDataProtocolCombo.setToolTipText(Messages.TraceControl_CreateSessionProtocolTooltip);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.horizontalSpan = 1;
+ fDataProtocolCombo.setLayoutData(data);
+
+ String items[] = new String[StreamingProtocol.values().length];
+ for (int i = 0; i < items.length; i++) {
+ items[i] = StreamingProtocol.values()[i].name();
+ }
+ fControlProtocolCombo.setItems(items);
+ fDataProtocolCombo.setItems(items);
+
+ fDataHostAddressText = new Text(urlGroup, SWT.NONE);
+ fDataHostAddressText.setEnabled(false);
+ fDataHostAddressText.setToolTipText(Messages.TraceControl_CreateSessionDataAddressTooltip);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.horizontalSpan = 4;
+ fDataHostAddressText.setLayoutData(data);
+
+ fDataPortText = new Text(urlGroup, SWT.NONE);
+ fDataPortText.setEnabled(true);
+ fDataPortText.setToolTipText(Messages.TraceControl_CreateSessionDataPortTooltip);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.horizontalSpan = 1;
+ fDataPortText.setLayoutData(data);
+
+ fCopyProtocolSelectionListener = new ControlProtocolSelectionListener();
+ fControlProtocolSelectionListener = new ProtocolComboSelectionListener(fControlProtocolCombo, fControlPortText);
+ fDataProtocolSelectionListener = new ProtocolComboSelectionListener(fDataProtocolCombo, fDataPortText);
+
+ fControlProtocolCombo.addSelectionListener(fCopyProtocolSelectionListener);
+
+ fControlUrlKeyListener = new CopyKeyListener(fControlHostAddressText, fDataHostAddressText);
+ fControlHostAddressText.addKeyListener(fControlUrlKeyListener);
+
+// InetAddress inet = null;
+// try {
+// inet = InetAddress.getLocalHost();
+// inet = InetAddress.getByName(inet.getHostName());
+// } catch (UnknownHostException e1) {
+// }
+// if (inet != null) {
+// fControlUrlAddressText.setText(inet.getHostAddress());
+// fDataUrlAddressText.setText(inet.getHostAddress());
+// }
+ fControlProtocolCombo.select(DEFAULT_URL_INDEX);
+ fDataProtocolCombo.select(DEFAULT_URL_INDEX);
+
+ fLinkDataWithControlButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (fLinkDataWithControlButton.getSelection()) {
+ // Set enablement control data channel inputs
+ fDataProtocolCombo.setEnabled(false);
+ fDataHostAddressText.setEnabled(false);
+ fControlPortText.setEnabled(true);
+ fDataPortText.setEnabled(true);
+
+ // Update listeners
+ fControlProtocolCombo.removeSelectionListener(fControlProtocolSelectionListener);
+ fDataProtocolCombo.removeSelectionListener(fDataProtocolSelectionListener);
+ fControlProtocolCombo.addSelectionListener(fCopyProtocolSelectionListener);
+ fControlHostAddressText.addKeyListener(fControlUrlKeyListener);
+
+ // Get previous selection and validate
+ int currentSelection = fControlProtocolCombo.getSelectionIndex() <= COMMON_URL_LAST_INDEX ?
+ fControlProtocolCombo.getSelectionIndex() : DEFAULT_URL_INDEX;
+
+ // Update combo box items
+ fControlProtocolCombo.removeAll();
+ String[] controlItems = new String[StreamingProtocol.values().length];
+ for (int i = 0; i < controlItems.length; i++) {
+ controlItems[i] = StreamingProtocol.values()[i].name();
+ }
+ fControlProtocolCombo.setItems(controlItems);
+ fDataProtocolCombo.setItems(controlItems);
+
+ // Set selection
+ fControlProtocolCombo.select(currentSelection);
+ fDataProtocolCombo.select(currentSelection);
+ fDataHostAddressText.setText(fControlHostAddressText.getText());
+
+ // Update tool tips
+ fControlProtocolCombo.setToolTipText(Messages.TraceControl_CreateSessionCommonProtocolTooltip);
+ } else {
+ // Enable data channel inputs
+ fDataProtocolCombo.setEnabled(true);
+ fDataHostAddressText.setEnabled(true);
+
+ // Update listeners
+ fControlProtocolCombo.removeSelectionListener(fCopyProtocolSelectionListener);
+ fControlProtocolCombo.addSelectionListener(fControlProtocolSelectionListener);
+ fDataProtocolCombo.addSelectionListener(fDataProtocolSelectionListener);
+ fControlHostAddressText.removeKeyListener(fControlUrlKeyListener);
+
+ // Update combo box items
+ int currentSelection = fControlProtocolCombo.getSelectionIndex();
+ fControlProtocolCombo.removeAll();
+ String[] controlItems = new String[StreamingProtocol2.values().length];
+ for (int i = 0; i < controlItems.length; i++) {
+ controlItems[i] = StreamingProtocol2.values()[i].name();
+ }
+ fControlProtocolCombo.setItems(controlItems);
+ fDataProtocolCombo.setItems(controlItems);
+
+ // Set selection
+ fControlProtocolCombo.select(currentSelection);
+ fDataProtocolCombo.select(currentSelection);
+
+ // Update tool tips
+ fDataProtocolCombo.setToolTipText(Messages.TraceControl_CreateSessionProtocolTooltip);
+ fControlProtocolCombo.setToolTipText(Messages.TraceControl_CreateSessionProtocolTooltip);
+
+ // Update control/data port enablement and input
+ if (fControlProtocolCombo.getItem(fControlProtocolCombo.getSelectionIndex()).equals(StreamingProtocol.net.name()) ||
+ fControlProtocolCombo.getItem(fControlProtocolCombo.getSelectionIndex()).equals(StreamingProtocol.net6.name())) {
+ fControlPortText.setText(""); //$NON-NLS-1$
+ fControlPortText.setEnabled(false);
+ } else {
+ fControlPortText.setEnabled(true);
+ }
+
+ if (fDataProtocolCombo.getItem(fDataProtocolCombo.getSelectionIndex()).equals(StreamingProtocol.net.name()) ||
+ fDataProtocolCombo.getItem(fDataProtocolCombo.getSelectionIndex()).equals(StreamingProtocol.net6.name())) {
+ fDataPortText.setText(""); //$NON-NLS-1$
+ fDataPortText.setEnabled(false);
+ } else {
+ fDataPortText.setEnabled(true);
+ }
+ }
+ }
+ });
+ }
+ }
+
+ private void disposeConfigureStreamingComposite() {
+ if (fStreamingComposite != null) {
+ fStreamingComposite.dispose();
+ fStreamingComposite = null;
+ }
+ }
+
/*
* (non-Javadoc)
* @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
@@ -204,36 +676,86 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog
if (!"".equals(fSessionPath)) { //$NON-NLS-1$
// validate sessionPath
-
- TargetNodeComponent node = (TargetNodeComponent)fParent.getParent();
- IRemoteSystemProxy proxy = node.getRemoteSystemProxy();
- IFileServiceSubSystem fsss = proxy.getFileServiceSubSystem();
- if (fsss != null) {
- try {
- IRemoteFile remoteFolder = fsss.getRemoteFileObject(fSessionPath, new NullProgressMonitor());
- if (remoteFolder.exists()) {
+ if (!fIsStreamedTrace) {
+ TargetNodeComponent node = (TargetNodeComponent)fParent.getParent();
+ IRemoteSystemProxy proxy = node.getRemoteSystemProxy();
+ IFileServiceSubSystem fsss = proxy.getFileServiceSubSystem();
+ if (fsss != null) {
+ try {
+ IRemoteFile remoteFolder = fsss.getRemoteFileObject(fSessionPath, new NullProgressMonitor());
+ if (remoteFolder.exists()) {
+ MessageDialog.openError(getShell(),
+ Messages.TraceControl_CreateSessionDialogTitle,
+ Messages.TraceControl_SessionPathAlreadyExistsError + " (" + fSessionPath + ") \n"); //$NON-NLS-1$ //$NON-NLS-2$
+ return;
+ }
+ } catch (SystemMessageException e) {
MessageDialog.openError(getShell(),
Messages.TraceControl_CreateSessionDialogTitle,
- Messages.TraceControl_SessionPathAlreadyExistsError + " (" + fSessionPath + ") \n"); //$NON-NLS-1$ //$NON-NLS-2$
+ Messages.TraceControl_FileSubSystemError + "\n" + e); //$NON-NLS-1$
return;
}
- } catch (SystemMessageException e) {
- MessageDialog.openError(getShell(),
- Messages.TraceControl_CreateSessionDialogTitle,
- Messages.TraceControl_FileSubSystemError + "\n" + e); //$NON-NLS-1$
- return;
- }
+ }
}
fIsDefaultPath = false;
}
- // If no session name is specified use default name auto
- if ("".equals(fSessionName)) { //$NON-NLS-1$
- fSessionName = "auto"; //$NON-NLS-1$
+ fNetworkUrl = null;
+ fControlUrl = null;
+ fDataUrl = null;
+
+ if (fIsStreamedTrace) {
+ if (fControlProtocolCombo.getSelectionIndex() < 0) {
+ MessageDialog.openError(getShell(),
+ Messages.TraceControl_CreateSessionDialogTitle,
+ "Control Protocol Text is empty\n"); //$NON-NLS-1$
+ return;
+ }
+
+ if ("".equals(fControlHostAddressText.getText())) { //$NON-NLS-1$
+ MessageDialog.openError(getShell(),
+ Messages.TraceControl_CreateSessionDialogTitle,
+ "Control Address Text is empty\n"); //$NON-NLS-1$
+ return;
+ }
+
+ if(!fLinkDataWithControlButton.getSelection()) {
+ if (fDataProtocolCombo.getSelectionIndex() < 0) {
+ MessageDialog.openError(getShell(),
+ Messages.TraceControl_CreateSessionDialogTitle,
+ "Control Protocol Text is empty\n"); //$NON-NLS-1$
+ return;
+ }
+
+ if ("".equals(fDataHostAddressText.getText())) { //$NON-NLS-1$
+ MessageDialog.openError(getShell(),
+ Messages.TraceControl_CreateSessionDialogTitle,
+ "Control Address Text is empty\n"); //$NON-NLS-1$
+ return;
+ }
+
+ fControlUrl = getUrlString(fControlProtocolCombo.getItem(fControlProtocolCombo.getSelectionIndex()),
+ fControlHostAddressText.getText(),
+ fControlPortText.getText(),
+ null,
+ fSessionPath);
+
+ fDataUrl = getUrlString(fControlProtocolCombo.getItem(fDataProtocolCombo.getSelectionIndex()),
+ fDataHostAddressText.getText(),
+ null,
+ fDataPortText.getText(),
+ fSessionPath);
+ } else {
+ fNetworkUrl = getUrlString(fControlProtocolCombo.getItem(fDataProtocolCombo.getSelectionIndex()),
+ fControlHostAddressText.getText(),
+ fControlPortText.getText(),
+ fDataPortText.getText(),
+ fSessionPath);
+ }
}
// Check for invalid names
- if (!fSessionName.matches("^[a-zA-Z0-9\\-\\_]{1,}$")) { //$NON-NLS-1$
+ if (!"".equals(fSessionName) && !fSessionName.matches("^[a-zA-Z0-9\\-\\_]{1,}$")) { //$NON-NLS-1$ //$NON-NLS-2$
MessageDialog.openError(getShell(),
Messages.TraceControl_CreateSessionDialogTitle,
Messages.TraceControl_InvalidSessionNameError + " (" + fSessionName + ") \n"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -247,8 +769,92 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog
Messages.TraceControl_SessionAlreadyExistsError + " (" + fSessionName + ")"); //$NON-NLS-1$ //$NON-NLS-2$
return;
}
-
+
+ if (fParent.isNetworkStreamingSupported()) {
+ fIsNoConsumer = fNoConsumerButton.getSelection();
+ fIsDisableConsumer = fDisableConsumerButton.getSelection();
+ }
+
// validation successful -> call super.okPressed()
super.okPressed();
}
+
+ private static String getUrlString(String proto, String host, String ctrlPort, String dataPort, String sessionPath) {
+ //proto://[HOST|IP][:PORT1[:PORT2]][/TRACE_PATH]
+ StringBuilder stringBuilder = new StringBuilder();
+ stringBuilder.append(proto);
+ stringBuilder.append("://"); //$NON-NLS-1$
+ stringBuilder.append(host);
+
+ if ((ctrlPort != null) && (!"".equals(ctrlPort))) { //$NON-NLS-1$
+ stringBuilder.append(":"); //$NON-NLS-1$
+ stringBuilder.append(ctrlPort);
+ }
+
+ if ((dataPort != null) && (!"".equals(dataPort))) { //$NON-NLS-1$
+ stringBuilder.append(":"); //$NON-NLS-1$
+ stringBuilder.append(dataPort);
+ }
+
+ if ((sessionPath != null) && (!"".equals(sessionPath))) { //$NON-NLS-1$
+ stringBuilder.append("/"); //$NON-NLS-1$
+ stringBuilder.append(sessionPath);
+ }
+ return stringBuilder.toString();
+ }
+
+ private static class CopyKeyListener extends KeyAdapter {
+ private Text fSource;
+ private Text fDestination;
+
+ public CopyKeyListener(Text source, Text destination) {
+ fSource = source;
+ fDestination = destination;
+ }
+
+ @Override
+ public void keyReleased(KeyEvent e) {
+ fDestination.setText(fSource.getText());
+ }
+ }
+
+ private class ControlProtocolSelectionListener extends SelectionAdapter {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ fDataProtocolCombo.select(fControlProtocolCombo.getSelectionIndex());
+ if (fControlProtocolCombo.getItem(fControlProtocolCombo.getSelectionIndex()).equals(StreamingProtocol.file.name())) {
+ fControlPortText.setText(""); //$NON-NLS-1$
+ fDataPortText.setText(""); //$NON-NLS-1$
+ fControlPortText.setEnabled(false);
+ fDataPortText.setEnabled(false);
+ } else {
+ fControlPortText.setEnabled(true);
+ fDataPortText.setEnabled(true);
+ }
+ }
+ }
+
+ private class ProtocolComboSelectionListener extends SelectionAdapter {
+
+ private CCombo fCombo;
+ private Text fPortText;
+
+ public ProtocolComboSelectionListener(CCombo combo, Text portText) {
+ fCombo = combo;
+ fPortText = portText;
+ }
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (fCombo.getItem(fCombo.getSelectionIndex()).equals(StreamingProtocol.net.name()) ||
+ fCombo.getItem(fCombo.getSelectionIndex()).equals(StreamingProtocol.net6.name())) {
+ fPortText.setText(""); //$NON-NLS-1$
+ fPortText.setEnabled(false);
+ } else {
+ fPortText.setEnabled(true);
+ }
+ }
+ }
+
}
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/ICreateSessionDialog.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/ICreateSessionDialog.java
index 2b42951..ef13775 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/ICreateSessionDialog.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/ICreateSessionDialog.java
@@ -1,12 +1,12 @@
/**********************************************************************
* Copyright (c) 2012 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
**********************************************************************/
package org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs;
@@ -17,11 +17,11 @@ import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceS
* <p>
* Interface for create session dialog.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public interface ICreateSessionDialog {
-
+
// ------------------------------------------------------------------------
// Accessors
// ------------------------------------------------------------------------
@@ -34,17 +34,57 @@ public interface ICreateSessionDialog {
* @return the session path (null for default path)
*/
public String getSessionPath();
-
+
/**
* @return true for default location else false
*/
public boolean isDefaultSessionPath();
-
+
/**
- * Set trace session group.
+ * Initializes the dialog box.
* @param group - the session group
*/
- public void setTraceSessionGroup(TraceSessionGroup group);
+ public void initialize(TraceSessionGroup group);
+
+ /**
+ * @return true if traces is to be streamed else false.
+ */
+ public boolean isStreamedTrace();
+
+ /**
+ * Get the network URL in case control and data is configured together otherwise null
+ * If it returns a non-null value, getControlUrl() and getDataUrl() have to return null.
+ * @return The network URL or null.
+ */
+ public String getNetworkUrl();
+
+ /**
+ * Get the control URL in case control and data is configured separately.
+ * If it returns a non-null value, getDataUrl() has to return a valid value too
+ * and getNetworkUrl() has to return null.
+ *
+ * @return The control URL or null.
+ */
+ public String getControlUrl();
+
+ /**
+ * Get the data URL in case control and data is configured separately.
+ * If it returns a non-null value, getControlUrl() has to return a valid value too
+ * and getNetworkUrl() has to return null.
+ *
+ * @return The data URL or null.
+ */
+ public String getDataUrl();
+
+ /**
+ * @return for not activating a consumer for this session
+ */
+ public boolean isNoConsumer();
+
+ /**
+ * @return for disabling a consumer for this session
+ */
+ public boolean isDisableConsumer();
// ------------------------------------------------------------------------
// Operations
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/ImportDialog.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/ImportDialog.java
index fd9fac0..8700e9f 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/ImportDialog.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/ImportDialog.java
@@ -25,13 +25,16 @@ import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTreeViewer;
import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.window.Window;
+import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.linuxtools.internal.lttng2.ui.Activator;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.messages.Messages;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceSessionComponent;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.remote.IRemoteSystemProxy;
import org.eclipse.linuxtools.tmf.core.TmfProjectNature;
import org.eclipse.linuxtools.tmf.ui.project.model.TmfTraceFolder;
+import org.eclipse.linuxtools.tmf.ui.project.wizards.ImportTraceWizard;
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSystem;
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
@@ -47,6 +50,7 @@ import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Tree;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.model.WorkbenchContentProvider;
import org.eclipse.ui.model.WorkbenchLabelProvider;
@@ -88,6 +92,10 @@ public class ImportDialog extends Dialog implements IImportDialog {
*/
private Button fOverwriteButton;
/**
+ * The button to open import wizard for import locally.
+ */
+ private Button fImportLocallyButton;
+ /**
* List of available LTTng 2.0 projects
*/
private List<IProject> fProjects;
@@ -179,91 +187,19 @@ public class ImportDialog extends Dialog implements IImportDialog {
fDialogComposite.setLayout(layout);
fDialogComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
- Group contextGroup = new Group(fDialogComposite, SWT.SHADOW_NONE);
- contextGroup.setText(Messages.TraceControl_ImportDialogTracesGroupName);
- layout = new GridLayout(1, true);
- contextGroup.setLayout(layout);
- contextGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- IRemoteSystemProxy proxy = fSession.getTargetNode().getRemoteSystemProxy();
-
- IFileServiceSubSystem fsss = proxy.getFileServiceSubSystem();
-
try {
- IRemoteFile remoteFolder = fsss.getRemoteFileObject(fSession.getSessionPath(), new NullProgressMonitor());
-
- fFolderViewer = new CheckboxTreeViewer(contextGroup, SWT.BORDER);
- GridData data = new GridData(GridData.FILL_BOTH);
- Tree tree = fFolderViewer.getTree();
- tree.setLayoutData(data);
- tree.setFont(parent.getFont());
- tree.setToolTipText(Messages.TraceControl_ImportDialogTracesTooltip);
-
- fFolderViewer.setContentProvider(new FolderContentProvider());
- fFolderViewer.setLabelProvider(new WorkbenchLabelProvider());
-
- fFolderViewer.addCheckStateListener(new ICheckStateListener() {
- @Override
- public void checkStateChanged(CheckStateChangedEvent event) {
- Object elem = event.getElement();
- if (elem instanceof IRemoteFile) {
- IRemoteFile element = (IRemoteFile) elem;
- if (!element.isDirectory()) {
- // A trick to keep selection of a file in sync with the directory
- boolean p = fFolderViewer.getChecked((element.getParentRemoteFile()));
- fFolderViewer.setChecked(element, p);
- return;
- }
- fFolderViewer.setSubtreeChecked(event.getElement(), event.getChecked());
- if (!event.getChecked()) {
- fFolderViewer.setChecked(element.getParentRemoteFile(), false);
- }
- }
- }
- });
- fFolderViewer.setInput(remoteFolder);
-
- Group projectGroup = new Group(fDialogComposite, SWT.SHADOW_NONE);
- projectGroup.setText(Messages.TraceControl_ImportDialogProjectsGroupName);
- layout = new GridLayout(1, true);
- projectGroup.setLayout(layout);
- projectGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- fProjects = new ArrayList<IProject>();
- List<String> projectNames = new ArrayList<String>();
- for (IProject project : ResourcesPlugin.getWorkspace().getRoot().getProjects()) {
- try {
- if (project.isOpen() && project.hasNature(TmfProjectNature.ID)) {
- fProjects.add(project);
- projectNames.add(project.getName());
- }
- } catch (CoreException e) {
- createErrorComposite(parent, e.fillInStackTrace());
- return fDialogComposite;
- }
+ if (fSession.isStreamedTrace()) {
+ createLocalComposite();
+ } else {
+ createRemoteComposite();
}
-
- fCombo = new CCombo(projectGroup, SWT.READ_ONLY);
- fCombo.setToolTipText(Messages.TraceControl_ImportDialogProjectsTooltip);
- fCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 1, 1));
- fCombo.setItems(projectNames.toArray(new String[projectNames.size()]));
-
- Group overrideGroup = new Group(fDialogComposite, SWT.SHADOW_NONE);
- layout = new GridLayout(1, true);
- overrideGroup.setLayout(layout);
- overrideGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- fOverwriteButton = new Button(overrideGroup, SWT.CHECK);
- fOverwriteButton.setText(Messages.TraceControl_ImportDialogOverwriteButtonText);
-
- getShell().setMinimumSize(new Point(500, 400));
-
-
+ } catch (CoreException e) {
+ createErrorComposite(parent, e.fillInStackTrace());
+ return fDialogComposite;
} catch (SystemMessageException e) {
createErrorComposite(parent, e.fillInStackTrace());
return fDialogComposite;
}
-
return fDialogComposite;
}
@@ -274,7 +210,10 @@ public class ImportDialog extends Dialog implements IImportDialog {
@Override
protected void createButtonsForButtonBar(Composite parent) {
createButton(parent, IDialogConstants.CANCEL_ID, "&Cancel", true); //$NON-NLS-1$
- createButton(parent, IDialogConstants.OK_ID, "&Ok", true); //$NON-NLS-1$
+ fImportLocallyButton = createButton(parent, IDialogConstants.OK_ID, "&Ok", true); //$NON-NLS-1$
+ if (fSession.isStreamedTrace()) {
+ fImportLocallyButton.setText("&Next..."); //$NON-NLS-1$
+ }
}
/*
@@ -284,6 +223,7 @@ public class ImportDialog extends Dialog implements IImportDialog {
@Override
protected void okPressed() {
if (!fIsError) {
+
// Validate input data
fTraces.clear();
@@ -296,6 +236,20 @@ public class ImportDialog extends Dialog implements IImportDialog {
return;
}
+ if (fSession.isStreamedTrace()) {
+ // For streaming use standard import wizard from TMF because exact location
+ // is not available (lttng backend limitation)
+ IProject project = fProjects.get(fCombo.getSelectionIndex());
+ ImportTraceWizard wizard = new ImportTraceWizard();
+ wizard.init(PlatformUI.getWorkbench(), new StructuredSelection(project));
+ WizardDialog dialog = new WizardDialog(getShell(), wizard);
+ if (dialog.open() == Window.OK) {
+ super.okPressed();
+ }
+ super.cancelPressed();
+ return;
+ }
+
IProject project = fProjects.get(fProjectIndex);
IFolder traceFolder = project.getFolder(TmfTraceFolder.TRACE_FOLDER_NAME);
@@ -400,5 +354,110 @@ public class ImportDialog extends Dialog implements IImportDialog {
errorText.setLayoutData(new GridData(GridData.FILL_BOTH));
}
+ private void createRemoteComposite() throws CoreException, SystemMessageException{
+ Group contextGroup = new Group(fDialogComposite, SWT.SHADOW_NONE);
+ contextGroup.setText(Messages.TraceControl_ImportDialogTracesGroupName);
+ GridLayout layout = new GridLayout(1, true);
+ contextGroup.setLayout(layout);
+ contextGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ IRemoteSystemProxy proxy = fSession.getTargetNode().getRemoteSystemProxy();
+
+ IFileServiceSubSystem fsss = proxy.getFileServiceSubSystem();
+
+ IRemoteFile remoteFolder = fsss.getRemoteFileObject(fSession.getSessionPath(), new NullProgressMonitor());
+
+ fFolderViewer = new CheckboxTreeViewer(contextGroup, SWT.BORDER);
+ GridData data = new GridData(GridData.FILL_BOTH);
+ Tree tree = fFolderViewer.getTree();
+ tree.setLayoutData(data);
+ tree.setFont(fDialogComposite.getFont());
+ tree.setToolTipText(Messages.TraceControl_ImportDialogTracesTooltip);
+
+ fFolderViewer.setContentProvider(new FolderContentProvider());
+ fFolderViewer.setLabelProvider(new WorkbenchLabelProvider());
+
+ fFolderViewer.addCheckStateListener(new ICheckStateListener() {
+ @Override
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ Object elem = event.getElement();
+ if (elem instanceof IRemoteFile) {
+ IRemoteFile element = (IRemoteFile) elem;
+ if (!element.isDirectory()) {
+ // A trick to keep selection of a file in sync with the directory
+ boolean p = fFolderViewer.getChecked((element.getParentRemoteFile()));
+ fFolderViewer.setChecked(element, p);
+ return;
+ }
+ fFolderViewer.setSubtreeChecked(event.getElement(), event.getChecked());
+ if (!event.getChecked()) {
+ fFolderViewer.setChecked(element.getParentRemoteFile(), false);
+ }
+ }
+ }
+ });
+ fFolderViewer.setInput(remoteFolder);
+
+ Group projectGroup = new Group(fDialogComposite, SWT.SHADOW_NONE);
+ projectGroup.setText(Messages.TraceControl_ImportDialogProjectsGroupName);
+ layout = new GridLayout(1, true);
+ projectGroup.setLayout(layout);
+ projectGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ fProjects = new ArrayList<IProject>();
+ List<String> projectNames = new ArrayList<String>();
+ for (IProject project : ResourcesPlugin.getWorkspace().getRoot().getProjects()) {
+ if (project.isOpen() && project.hasNature(TmfProjectNature.ID)) {
+ fProjects.add(project);
+ projectNames.add(project.getName());
+ }
+ }
+
+ fCombo = new CCombo(projectGroup, SWT.READ_ONLY);
+ fCombo.setToolTipText(Messages.TraceControl_ImportDialogProjectsTooltip);
+ fCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 1, 1));
+ fCombo.setItems(projectNames.toArray(new String[projectNames.size()]));
+
+ Group overrideGroup = new Group(fDialogComposite, SWT.SHADOW_NONE);
+ layout = new GridLayout(1, true);
+ overrideGroup.setLayout(layout);
+ overrideGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ fOverwriteButton = new Button(overrideGroup, SWT.CHECK);
+ fOverwriteButton.setText(Messages.TraceControl_ImportDialogOverwriteButtonText);
+ getShell().setMinimumSize(new Point(500, 400));
+ }
+
+ private void createLocalComposite() throws CoreException {
+
+ Group projectGroup = new Group(fDialogComposite, SWT.SHADOW_NONE);
+ projectGroup.setText(Messages.TraceControl_ImportDialogProjectsGroupName);
+ GridLayout layout = new GridLayout(1, true);
+ projectGroup.setLayout(layout);
+ projectGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ fProjects = new ArrayList<IProject>();
+ List<String> projectNames = new ArrayList<String>();
+ for (IProject project : ResourcesPlugin.getWorkspace().getRoot().getProjects()) {
+ if (project.isOpen() && project.hasNature(TmfProjectNature.ID)) {
+ fProjects.add(project);
+ projectNames.add(project.getName());
+ }
+ }
+
+ fCombo = new CCombo(projectGroup, SWT.READ_ONLY);
+ fCombo.setToolTipText(Messages.TraceControl_ImportDialogProjectsTooltip);
+ fCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 1, 1));
+ fCombo.setItems(projectNames.toArray(new String[projectNames.size()]));
+// Group overrideGroup = new Group(fDialogComposite, SWT.SHADOW_NONE);
+// layout = new GridLayout(1, true);
+// overrideGroup.setLayout(layout);
+// overrideGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+//
+// fOverwriteButton = new Button(overrideGroup, SWT.CHECK);
+// fOverwriteButton.setText(Messages.TraceControl_ImportDialogOverwriteButtonText);
+
+ getShell().setMinimumSize(new Point(500, 50));
+ }
}
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/CreateSessionHandler.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/CreateSessionHandler.java
index 9098c7b..3e379cb 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/CreateSessionHandler.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/CreateSessionHandler.java
@@ -60,21 +60,25 @@ public class CreateSessionHandler extends BaseControlViewHandler {
final TraceSessionGroup sessionGroup = fSessionGroup;
// Open dialog box for the node name and address
- ICreateSessionDialog dialog = TraceControlDialogFactory.getInstance().getCreateSessionDialog();
- dialog.setTraceSessionGroup(sessionGroup);
+ final ICreateSessionDialog dialog = TraceControlDialogFactory.getInstance().getCreateSessionDialog();
+ dialog.initialize(sessionGroup);
if (dialog.open() != Window.OK) {
return null;
}
- final String sessionName = dialog.getSessionName();
- final String sessionPath = dialog.isDefaultSessionPath() ? null : dialog.getSessionPath();
-
Job job = new Job(Messages.TraceControl_CreateSessionJob) {
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
- sessionGroup.createSession(sessionName, sessionPath, monitor);
+ if (dialog.isStreamedTrace()) {
+ sessionGroup.createSession(dialog.getSessionName(), dialog.getNetworkUrl(), dialog.getControlUrl(),
+ dialog.getDataUrl(), dialog.isNoConsumer(), dialog.isDisableConsumer(), monitor);
+ } else {
+ String sessionPath = dialog.isDefaultSessionPath() ? null : dialog.getSessionPath();
+ sessionGroup.createSession(dialog.getSessionName(), sessionPath, dialog.isNoConsumer(),
+ dialog.isDisableConsumer(), monitor);
+ }
} catch (ExecutionException e) {
return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_CreateSessionFailure, e);
}
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/ImportHandler.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/ImportHandler.java
index 44bc336..f5f38b3 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/ImportHandler.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/ImportHandler.java
@@ -90,7 +90,7 @@ public class ImportHandler extends BaseControlViewHandler {
final IImportDialog dialog = TraceControlDialogFactory.getInstance().getImportDialog();
dialog.setSession(param.getSession());
- if (dialog.open() != Window.OK) {
+ if ((dialog.open() != Window.OK) || param.getSession().isStreamedTrace()) {
return null;
}
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/Messages.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/Messages.java
index 20b285a..fed63b9 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/Messages.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/Messages.java
@@ -98,6 +98,29 @@ final public class Messages extends NLS {
public static String TraceControl_CreateSessionNameTooltip;
public static String TraceControl_CreateSessionPathLabel;
public static String TraceControl_CreateSessionPathTooltip;
+
+ public static String TraceControl_CreateSessionConfigureStreamingButtonText;
+ public static String TraceControl_CreateSessionConfigureStreamingButtonTooltip;
+ public static String TraceControl_CreateSessionNoStreamingButtonText;
+ public static String TraceControl_CreateSessionNoStreamingButtonTooltip;
+ public static String TraceControl_CreateSessionLinkButtonText;
+ public static String TraceControl_CreateSessionLinkButtonTooltip;
+ public static String TraceControl_CreateSessionProtocolLabelText;
+ public static String TraceControl_CreateSessionAddressLabelText;
+ public static String TraceControl_CreateSessionPortLabelText;
+ public static String TraceControl_CreateSessionControlUrlLabel;
+ public static String TraceControl_CreateSessionDataUrlLabel;
+ public static String TraceControl_CreateSessionCommonProtocolTooltip;
+ public static String TraceControl_CreateSessionControlAddressTooltip;
+ public static String TraceControl_CreateSessionControlPortTooltip;
+ public static String TraceControl_CreateSessionProtocolTooltip;
+ public static String TraceControl_CreateSessionDataAddressTooltip;
+ public static String TraceControl_CreateSessionDataPortTooltip;
+ public static String TraceControl_CreateSessionNoConsumertText;
+ public static String TraceControl_CreateSessionNoConsumertTooltip;
+ public static String TraceControl_CreateSessionDisableConsumertText;
+ public static String TraceControl_CreateSessionDisableConsumertTooltip;
+
public static String TraceControl_InvalidSessionNameError;
public static String TraceControl_SessionAlreadyExistsError;
public static String TraceControl_SessionPathAlreadyExistsError;
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/messages.properties b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/messages.properties
index 55573d4..e6a89c5 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/messages.properties
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/messages.properties
@@ -81,6 +81,34 @@ TraceControl_CreateSessionNameLabel=Session Name
TraceControl_CreateSessionNameTooltip=The name of the session to be created.
TraceControl_CreateSessionPathLabel=Session Path
TraceControl_CreateSessionPathTooltip=The session path (keep empty for default location)
+
+TraceControl_CreateSessionConfigureStreamingButtonText=Configure Streaming
+TraceControl_CreateSessionConfigureStreamingButtonTooltip=Configure streaming parameters
+TraceControl_CreateSessionNoStreamingButtonText=Remove Streaming
+TraceControl_CreateSessionNoStreamingButtonTooltip=Remove streaming configuration
+TraceControl_CreateSessionLinkButtonText=Synchronize data with control configuration
+TraceControl_CreateSessionLinkButtonTooltip=Synchronize data protocol and host address with control channel configuration
+TraceControl_CreateSessionProtocolLabelText=Protocol
+TraceControl_CreateSessionAddressLabelText=Address
+TraceControl_CreateSessionPortLabelText=Port
+TraceControl_CreateSessionControlUrlLabel=Control URL
+TraceControl_CreateSessionDataUrlLabel=Data URL
+TraceControl_CreateSessionCommonProtocolTooltip=file - Local file system full path\n\
+net or net6 - Default network transport layer which is TCP for both control and data channel.
+TraceControl_CreateSessionControlAddressTooltip=IP Address or DNS name used for control channel.\n\
+NOTE: IPv6 address MUST be enclosed in brackets '[]' (rfc2732)
+TraceControl_CreateSessionControlPortTooltip=The control port (default: 5342).
+TraceControl_CreateSessionProtocolTooltip=file - Local file system full path\n\
+net or net6 - Default network transport layer which is TCP\n\
+tcp or tcp6 - TCP network transport
+TraceControl_CreateSessionDataAddressTooltip=IP Address or DNS name used for data channel.\n\
+NOTE: IPv6 address MUST be enclosed in brackets '[]' (rfc2732)
+TraceControl_CreateSessionDataPortTooltip=The data port (default: 5343).
+TraceControl_CreateSessionNoConsumertText=No Consumer
+TraceControl_CreateSessionNoConsumertTooltip=Don't activate a consumer for this session.
+TraceControl_CreateSessionDisableConsumertText=Disable Consumer
+TraceControl_CreateSessionDisableConsumertTooltip=Disable consumer for this session.
+
TraceControl_InvalidSessionNameError=The session name is invalid
TraceControl_SessionAlreadyExistsError=The session name already exists
TraceControl_SessionPathAlreadyExistsError=Session path already exists
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TargetNodeComponent.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TargetNodeComponent.java
index 8a46ce1..457812c 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TargetNodeComponent.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TargetNodeComponent.java
@@ -225,6 +225,15 @@ public class TargetNodeComponent extends TraceControlComponent implements ICommu
return getControlService().isVersionSupported("2.1.0"); //$NON-NLS-1$
}
+ /**
+ * Returns if node supports networks streaming or not
+ * @return <code>true</code> if node supports filtering else <code>false</code>
+ *
+ */
+ public boolean isNetworkStreamingSupported() {
+ return getControlService().isVersionSupported("2.1.0"); //$NON-NLS-1$
+ }
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceSessionComponent.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceSessionComponent.java
index 7fec67c..3f10d9a 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceSessionComponent.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceSessionComponent.java
@@ -165,6 +165,22 @@ public class TraceSessionComponent extends TraceControlComponent {
fSessionInfo.setSessionPath(sessionPath);
}
+ /**
+ * Returns if session is streamed over network
+ * @return <code>true</code> if streamed over network else <code>false</code>
+ */
+ public boolean isStreamedTrace() {
+ return fSessionInfo.isStreamedTrace();
+ }
+
+ /**
+ * Sets whether the trace is streamed or not
+ * @param isStreamedTrace <code>true</code> if streamed over network else <code>false</code>
+ */
+ public void setIsStreamedTrace(boolean isStreamedTrace) {
+ fSessionInfo.setStreamedTrace(isStreamedTrace);
+ }
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceControlComponent#getAdapter(java.lang.Class)
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceSessionGroup.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceSessionGroup.java
index 87177ef..20e315d 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceSessionGroup.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceSessionGroup.java
@@ -61,6 +61,14 @@ 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();
+ }
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
@@ -100,12 +108,15 @@ public class TraceSessionGroup extends TraceControlComponent {
* - a session name to create
* @param sessionPath
* - a path for storing the traces (use null for default)
+ * @param noConsumer
+ * - a flag to indicate no consumer
+ * @param disableConsumer
+ * - a flag to disable consumer
* @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 noConsumer, boolean disableConsumer) throws ExecutionException {
+ createSession(sessionName, sessionPath, noConsumer, disableConsumer, new NullProgressMonitor());
}
/**
@@ -115,15 +126,18 @@ public class TraceSessionGroup extends TraceControlComponent {
* - a session name to create
* @param sessionPath
* - a path for storing the traces (use null for default)
+ * @param noConsumer
+ * - a flag to indicate no consumer
+ * @param disableConsumer
+ * - a flag to disable consumer
* @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 sessionPath, boolean noConsumer, boolean disableConsumer, IProgressMonitor monitor) throws ExecutionException {
+ ISessionInfo sessionInfo = getControlService().createSession(sessionName, sessionPath, noConsumer, disableConsumer, monitor);
+
if (sessionInfo != null) {
TraceSessionComponent session = new TraceSessionComponent(
sessionInfo.getName(), TraceSessionGroup.this);
@@ -133,6 +147,60 @@ public class TraceSessionGroup extends TraceControlComponent {
}
/**
+ * 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 noConsumer
+ * - a flag to indicate no consumer
+ * @param disableConsumer
+ * - a flag to disable consumer
+ * @throws ExecutionException
+ * If the command fails
+ */
+ public void createSession(String sessionName, String networkUrl, String controlUrl, String dataUrl, boolean noConsumer, boolean disableConsumer) throws ExecutionException {
+ createSession(sessionName, networkUrl, controlUrl, dataUrl, noConsumer, disableConsumer, new NullProgressMonitor());
+ }
+
+ /**
+ * 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 noConsumer
+ * - a flag to indicate no consumer
+ * @param disableConsumer
+ * - a flag to disable consumer
+ * @param monitor
+ * - a progress monitor
+ * @throws ExecutionException
+ * If the command fails
+ */
+ public void createSession(String sessionName, String networkUrl, String controlUrl, String dataUrl, boolean noConsumer, boolean disableConsumer, IProgressMonitor monitor) throws ExecutionException {
+ ISessionInfo sessionInfo = getControlService().createSession(sessionName, networkUrl, controlUrl, dataUrl, noConsumer, disableConsumer, monitor);
+
+ if (sessionInfo != null) {
+ TraceSessionComponent session = new TraceSessionComponent(sessionInfo.getName(), TraceSessionGroup.this);
+ addChild(session);
+ session.getConfigurationFromNode(monitor);
+ }
+ }
+
+ /**
* Destroys a session with given session name.
*
* @param session
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/ILttngControlService.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/ILttngControlService.java
index 4499a09..b068361 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/ILttngControlService.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/ILttngControlService.java
@@ -121,6 +121,52 @@ public interface ILttngControlService {
IProgressMonitor monitor) throws ExecutionException;
/**
+ * 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 noConsumer
+ * - a flag to indicate no consumer
+ * @param disableConsumer
+ * - a flag to disable consumer
+ * @param monitor
+ * - a progress monitor
+ * @return the session information
+ * @throws ExecutionException
+ * If the command fails
+ */
+ public ISessionInfo createSession(String sessionName, String sessionPath, boolean noConsumer, boolean disableConsumer,
+ IProgressMonitor monitor) throws ExecutionException;
+
+
+ /**
+ * 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 noConsumer
+ * - a flag to indicate no consumer
+ * @param disableConsumer
+ * - a flag to disable consumer
+ * @param monitor
+ * - a progress monitor
+ * @return the session information
+ * @throws ExecutionException
+ * If the command fails
+ */
+ public ISessionInfo createSession(String sessionName, String networkUrl, String controlUrl, String dataUrl, boolean noConsumer, boolean disableConsumer,
+ IProgressMonitor monitor) throws ExecutionException;
+
+ /**
* Destroys a session with given session name.
*
* @param sessionName
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlService.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlService.java
index 92a28c2..d70f412 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlService.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlService.java
@@ -184,6 +184,11 @@ public class LTTngControlService implements ILttngControlService {
continue;
}
+ matcher = LTTngControlServiceConstants.TRACE_NETWORK_PATH_PATTERN.matcher(line);
+ if (matcher.matches()) {
+ sessionInfo.setStreamedTrace(true);
+ }
+
matcher = LTTngControlServiceConstants.TRACE_SESSION_PATH_PATTERN.matcher(line);
if (matcher.matches()) {
sessionInfo.setSessionPath(matcher.group(1).trim());
@@ -349,6 +354,12 @@ public class LTTngControlService implements ILttngControlService {
*/
@Override
public ISessionInfo createSession(String sessionName, String sessionPath, IProgressMonitor monitor) throws ExecutionException {
+ return createSession(sessionName, sessionPath, false, false, monitor);
+ }
+
+ @Override
+ public ISessionInfo createSession(String sessionName, String sessionPath, boolean noConsumer, boolean disableConsumer,
+ IProgressMonitor monitor) throws ExecutionException {
String newName = formatParameter(sessionName);
String newPath = formatParameter(sessionPath);
@@ -360,6 +371,12 @@ public class LTTngControlService implements ILttngControlService {
command.append(newPath);
}
+ if (noConsumer) {
+ command.append(LTTngControlServiceConstants.OPTION_NO_CONSUMER);
+ } else if (disableConsumer) {
+ command.append(LTTngControlServiceConstants.OPTION_DISABLE_CONSUMER);
+ }
+
ICommandResult result = executeCommand(command.toString(), monitor);
//Session myssession2 created.
@@ -379,33 +396,109 @@ public class LTTngControlService implements ILttngControlService {
formatOutput(result));
}
- if ((name == null) || (!name.equals(sessionName))) {
+ if ((name == null) || (!"".equals(sessionName) && !name.equals(sessionName))) { //$NON-NLS-1$
// Unexpected name returned
throw new ExecutionException(Messages.TraceControl_CommandError + " " + command + "\n" + //$NON-NLS-1$ //$NON-NLS-2$
Messages.TraceControl_UnexpectedNameError + ": " + name); //$NON-NLS-1$
}
- // Get and verify session path
- matcher = LTTngControlServiceConstants.CREATE_SESSION_PATH_PATTERN.matcher(output[1]);
- String path = null;
+ SessionInfo sessionInfo = new SessionInfo(name);
+
+ if (!noConsumer) {
+ // Get and verify session path
+ matcher = LTTngControlServiceConstants.CREATE_SESSION_PATH_PATTERN.matcher(output[1]);
+ String path = null;
+
+ if (matcher.matches()) {
+ path = String.valueOf(matcher.group(1).trim());
+ } else {
+ // Output format not expected
+ throw new ExecutionException(Messages.TraceControl_CommandError + " " + command + "\n" + //$NON-NLS-1$ //$NON-NLS-2$
+ Messages.TraceControl_UnexpectedCommandOutputFormat + ":\n" + //$NON-NLS-1$
+ formatOutput(result));
+ }
+
+ if ((path == null) || ((sessionPath != null) && (!path.contains(sessionPath)))) {
+ // Unexpected path
+ throw new ExecutionException(Messages.TraceControl_CommandError + " " + command + "\n" + //$NON-NLS-1$ //$NON-NLS-2$
+ Messages.TraceControl_UnexpectedPathError + ": " + name); //$NON-NLS-1$
+ }
+ sessionInfo.setSessionPath(path);
+ }
+
+ return sessionInfo;
+
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService#createSession(java.lang.String, java.lang.String, java.lang.String, java.lang.String, boolean, boolean, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public ISessionInfo createSession(String sessionName, String networkUrl, String controlUrl,
+ String dataUrl, boolean noConsumer, boolean disableConsumer, IProgressMonitor monitor) throws ExecutionException {
+
+ String newName = formatParameter(sessionName);
+ StringBuffer command = createCommand(LTTngControlServiceConstants.COMMAND_CREATE_SESSION, newName);
+
+ if (networkUrl != null) {
+ command.append(LTTngControlServiceConstants.OPTION_NETWORK_URL);
+ command.append(networkUrl);
+ } else {
+ command.append(LTTngControlServiceConstants.OPTION_CONTROL_URL);
+ command.append(controlUrl);
+
+ command.append(LTTngControlServiceConstants.OPTION_DATA_URL);
+ command.append(dataUrl);
+ }
+
+ if (noConsumer) {
+ command.append(LTTngControlServiceConstants.OPTION_NO_CONSUMER);
+ } else if (disableConsumer) {
+ command.append(LTTngControlServiceConstants.OPTION_DISABLE_CONSUMER);
+ }
+
+ ICommandResult result = executeCommand(command.toString(), monitor);
+
+ //Session myssession2 created.
+ //Traces will be written in /home/user/lttng-traces/myssession2-20120209-095418
+ String[] output = result.getOutput();
+
+ // Get and verify session name
+ Matcher matcher = LTTngControlServiceConstants.CREATE_SESSION_NAME_PATTERN.matcher(output[0]);
+ String name = null;
if (matcher.matches()) {
- path = String.valueOf(matcher.group(1).trim());
+ name = String.valueOf(matcher.group(1).trim());
} else {
// Output format not expected
throw new ExecutionException(Messages.TraceControl_CommandError + " " + command + "\n" + //$NON-NLS-1$ //$NON-NLS-2$
Messages.TraceControl_UnexpectedCommandOutputFormat + ":\n" + //$NON-NLS-1$
formatOutput(result));
}
-
- if ((path == null) || ((sessionPath != null) && (!path.contains(sessionPath)))) {
- // Unexpected path
- throw new ExecutionException(Messages.TraceControl_CommandError + " " + command + "\n" + //$NON-NLS-1$ //$NON-NLS-2$
- Messages.TraceControl_UnexpectedPathError + ": " + name); //$NON-NLS-1$
- }
+ // Get and verify session path
+ matcher = LTTngControlServiceConstants.CREATE_SESSION_PATH_PATTERN.matcher(output[1]);
+ String path = null;
SessionInfo sessionInfo = new SessionInfo(name);
- sessionInfo.setSessionPath(path);
+ if (!noConsumer && (networkUrl != null)) {
+ if (matcher.matches()) {
+ path = String.valueOf(matcher.group(1).trim());
+ } else {
+ // Output format not expected
+ throw new ExecutionException(Messages.TraceControl_CommandError + " " + command + "\n" + //$NON-NLS-1$ //$NON-NLS-2$
+ Messages.TraceControl_UnexpectedCommandOutputFormat + ":\n" + //$NON-NLS-1$
+ formatOutput(result));
+ }
+
+ if (path == null) {
+ // Unexpected path
+ throw new ExecutionException(Messages.TraceControl_CommandError + " " + command + "\n" + //$NON-NLS-1$ //$NON-NLS-2$
+ Messages.TraceControl_UnexpectedPathError + ": " + name); //$NON-NLS-1$
+ }
+ sessionInfo.setSessionPath(path);
+ }
+ sessionInfo.setStreamedTrace(true);
return sessionInfo;
}
@@ -1182,8 +1275,6 @@ public class LTTngControlService implements ILttngControlService {
return index;
}
-
-
/**
* Formats a command parameter for the command execution i.e. adds quotes
* at the beginning and end if necessary.
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceConstants.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceConstants.java
index 81b01b7..af9e72c 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceConstants.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceConstants.java
@@ -201,7 +201,26 @@ public class LTTngControlServiceConstants {
* Command line option for configuring event's filter
*/
public final static String OPTION_FILTER = " --filter "; //$NON-NLS-1$
-
+ /**
+ * Command line option for configuring the streaming network URL (common for control and data channel).
+ */
+ public final static String OPTION_NETWORK_URL = " -U "; //$NON-NLS-1$
+ /**
+ * Command line option for configuring the streaming control URL.
+ */
+ public final static String OPTION_CONTROL_URL = " -C "; //$NON-NLS-1$
+ /**
+ * Command line option for configuring the streaming data URL.
+ */
+ public final static String OPTION_DATA_URL = " -D "; //$NON-NLS-1$
+ /**
+ * Command line option for configuring of no consumer.
+ */
+ public final static String OPTION_NO_CONSUMER = " --no-consumer "; //$NON-NLS-1$
+ /**
+ * Command line option for disabling the consumer.
+ */
+ public final static String OPTION_DISABLE_CONSUMER = " --disable-consumer "; //$NON-NLS-1$
// ------------------------------------------------------------------------
// Parsing constants
@@ -227,6 +246,10 @@ public class LTTngControlServiceConstants {
*/
public final static Pattern TRACE_SESSION_PATH_PATTERN = Pattern.compile("\\s*Trace\\s+path\\:\\s+(.*)"); //$NON-NLS-1$
/**
+ * Patter to match session path for network tracing (lttng list <session>)
+ */
+ public final static Pattern TRACE_NETWORK_PATH_PATTERN = Pattern.compile("\\s*Trace\\s+path\\:\\s+(net|net6|file|tcp|tcp6|)\\:\\/\\/(.*)(\\:(\\d*)\\/(.*)\\[data\\:\\s+(\\d*)\\]){0,1}"); //$NON-NLS-1$
+ /**
* Pattern to match for kernel domain information (lttng list <session>)
*/
public final static Pattern DOMAIN_KERNEL_PATTERN = Pattern.compile("=== Domain: Kernel ==="); //$NON-NLS-1$
@@ -335,4 +358,5 @@ public class LTTngControlServiceConstants {
* Pattern to match error line if no kernel tracer is available or installed.
*/
public final static Pattern LIST_KERNEL_NO_KERNEL_PROVIDER_PATTERN = Pattern.compile("\\s*Error:\\s+Unable\\s+to\\s+list\\s+kernel\\s+events.*"); //$NON-NLS-1$;
+
}