/*******************************************************************************
* 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:
* Francois Chouinard - Initial API and implementation
*******************************************************************************/
* Test suite for the Activator class
* <p>
*/
+@SuppressWarnings("javadoc")
public class ActivatorTest extends TestCase {
// ------------------------------------------------------------------------
/*******************************************************************************
* 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:
* Francois Chouinard - Initial API and implementation
*******************************************************************************/
* <b><u>AllTests</u></b>
* <p>
*/
+@SuppressWarnings("javadoc")
public class AllTests {
public static Test suite() {
/*******************************************************************************
* Copyright (c) 2011 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
*******************************************************************************/
import junit.framework.Test;
import junit.framework.TestSuite;
+@SuppressWarnings("javadoc")
public class AllTests {
public static Test suite() {
-
+
TestSuite suite = new TestSuite(AllTests.class.getName());
//$JUnit-BEGIN$
suite.addTestSuite(TraceControlComponentTest.class);
/**********************************************************************
* 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.lttng2.ui.tests.control.model.component;
/**
* The class can be used to validate the listener interface.
- *
*/
+@SuppressWarnings("javadoc")
public class ListenerValidator implements ITraceControlComponentChangedListener {
// ------------------------------------------------------------------------
private boolean fisAddedCalled = false;
private boolean fisRemoveCalled = false;
private boolean fisChangedCalled = false;
-
+
private ITraceControlComponent fParent = null;
private ITraceControlComponent fChild = null;
private ITraceControlComponent fChangedComponent = null;
-
+
// ------------------------------------------------------------------------
// Accessors
// ------------------------------------------------------------------------
public ITraceControlComponent getSavedParent() {
return fParent;
}
-
+
public ITraceControlComponent getSavedChild() {
return fChild;
}
-
+
public ITraceControlComponent getSavedComponent() {
return fChangedComponent;
}
/*******************************************************************************
* 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
*******************************************************************************/
import junit.framework.Test;
/**
- * Test setup class for one-time setUp() and tearDown() across test cases.
+ * Test setup class for one-time setUp() and tearDown() across test cases.
*/
+@SuppressWarnings("javadoc")
public class ModelImplTestSetup extends TestSetup {
public ModelImplTestSetup(Test test) {
super(test);
}
-
+
/*
* (non-Javadoc)
* @see junit.extensions.TestSetup#setUp()
/**********************************************************************
* 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.lttng2.ui.tests.control.model.component;
* The class <code>TraceControlComponentTest</code> contains tests for the class <code>{@link TraceControlComponent}</code>.
*
*/
-@SuppressWarnings("nls")
+@SuppressWarnings({"nls", "javadoc"})
public class TraceControlComponentTest extends TestCase {
-
+
// ------------------------------------------------------------------------
// Test data
// ------------------------------------------------------------------------
-
+
// ------------------------------------------------------------------------
// Static methods
// ------------------------------------------------------------------------
/**
* Returns test setup used when executing test case stand-alone.
- * @return Test setup class
+ * @return Test setup class
*/
public static Test suite() {
return new ModelImplTestSetup(new TestSuite(TraceControlComponentTest.class));
@After
public void tearDown() throws Exception {
}
-
+
/**
* Run the TraceControlComponent(String) constructor test.
*/
public void testTraceControlComponent_1()
throws Exception {
-
+
String name = "node";
TraceControlComponent result = new TraceControlComponent(name);
fixture.addChild(new TraceControlRoot());
ITraceControlComponent component = new TraceControlRoot();
fixture.addChild(component);
-
+
ITraceControlComponent child = fixture.getChild(TraceControlRoot.TRACE_CONTROL_ROOT_NAME);
assertNotNull(child);
assertEquals(TraceControlRoot.TRACE_CONTROL_ROOT_NAME, child.getName());
* @throws Exception
*
*/
-
+
public void testAddComponentListener_1()
throws Exception {
TraceControlComponent fixture = new TraceControlComponent("", (ITraceControlComponent) null);
TraceControlRoot root = new TraceControlRoot();
fixture.addChild(root);
assertTrue(validator.isAddedCalled());
-
+
fixture.removeChild(root);
assertTrue(validator.isRemovedCalled());
* @throws Exception
*
*/
-
+
public void testFireCompenentUpdated()
throws Exception {
ITraceControlComponent parent = new TraceControlRoot();
-
+
TraceControlComponent fixture = new TraceControlComponent("node", parent);
fixture.setToolTip("");
-
+
ITraceControlComponent component = new TraceControlComponent("child");
fixture.addChild(component);
assertTrue(validator.isAddedCalled());
assertEquals(parent.getName(), validator.getSavedParent().getName());
assertEquals(component.getName(), validator.getSavedChild().getName());
-
+
validator.initialize();
-
+
fixture.fireComponentRemoved(parent, component);
assertTrue(validator.isRemovedCalled());
assertEquals(parent.getName(), validator.getSavedParent().getName());
* @throws Exception
*
*/
-
+
public void testGetAdapter()
throws Exception {
TraceControlComponent fixture = new TraceControlComponent("", new TraceControlRoot());
*/
public void testGetAndSetControlService_1()
throws Exception {
-
+
TraceControlComponent parent = new TraceControlComponent("parent") {
ILttngControlService fService = null;
-
+
@Override
public void setControlService(ILttngControlService service ) {
fService = service;
}
-
+
@Override
public ILttngControlService getControlService() {
return fService;
}
};
-
+
TraceControlComponent fixture = new TraceControlComponent("", parent);
parent.addChild(fixture);
fixture.setToolTip("");
TraceControlComponent child = new TraceControlComponent("child", fixture);
fixture.addChild(child);
-
+
ILttngControlService result = fixture.getControlService();
assertEquals(null, result);
-
+
TestRemoteSystemProxy proxy = new TestRemoteSystemProxy();
ILttngControlService service = new LTTngControlService(proxy.createCommandShell());
fixture.setControlService(service);
result = fixture.getControlService();
assertNotNull(service);
assertEquals(service, result);
-
+
result = fixture.getChildren()[0].getControlService();
assertNotNull(service);
assertEquals(service, result);
Image result = fixture.getImage();
assertEquals(null, result);
-
+
fixture.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER));
assertNotNull(fixture.getImage());
}
fixture.addChild(new TraceControlRoot());
fixture.addChild(new TraceControlComponent("child"));
-
+
fixture.removeAllChildren();
assertFalse(fixture.hasChildren());
}
TraceControlComponent fixture = new TraceControlComponent("", new TraceControlRoot());
fixture.setToolTip("");
TraceControlComponent child = new TraceControlComponent("child", fixture);
-
+
fixture.addChild(child);
fixture.removeChild(child);
assertFalse(fixture.hasChildren());
* @throws Exception
*
*/
-
+
public void testRemoveChild_2()
throws Exception {
TraceControlComponent fixture = new TraceControlComponent("", new TraceControlRoot());
throws Exception {
TraceControlComponent fixture = new TraceControlComponent("", (ITraceControlComponent) null);
fixture.setToolTip("");
-
+
ListenerValidator validator = new ListenerValidator();
fixture.addComponentListener(validator);
TraceControlRoot root = new TraceControlRoot();
fixture.addChild(root);
assertFalse(validator.isAddedCalled());
-
+
fixture.removeChild(root);
assertFalse(validator.isRemovedCalled());
/**
* Run the void setChildren(List<ITraceControlComponent>)/ITraceControlComponent[] getChildren() method test.
- *
+ *
*
* @throws Exception
*
children.add(new TraceControlComponent("child2"));
fixture.setChildren(children);
-
+
ITraceControlComponent[] result = fixture.getChildren();
assertEquals(2, result.length);
assertEquals("child1", result[0].getName());
*/
public void testGetAndSetTargetNodeState_1()
throws Exception {
-
+
TraceControlComponent parent = new TraceControlComponent("parent") {
private TargetNodeState fState;
-
+
@Override
public void setTargetNodeState(TargetNodeState state ) {
fState = state;
}
-
+
@Override
public TargetNodeState getTargetNodeState() {
return fState;
}
};
-
+
TraceControlComponent fixture = new TraceControlComponent("", parent);
parent.addChild(fixture);
-
+
fixture.setToolTip("");
TargetNodeState state = TargetNodeState.CONNECTED;
fixture.setTargetNodeState(state);
TargetNodeState result = fixture.getTargetNodeState();
-
+
assertNotNull(result);
assertEquals(state, result);
// Check also parent
assertEquals("DISCONNECTED", result.name());
assertEquals("DISCONNECTED", result.toString());
assertEquals(0, result.ordinal());
-
+
state = TargetNodeState.CONNECTING;
fixture.setTargetNodeState(state);
assertEquals("CONNECTING", result.name());
assertEquals("CONNECTING", result.toString());
assertEquals(3, result.ordinal());
-
+
fixture.setTargetNodeState(TargetNodeState.DISCONNECTING);
result = fixture.getTargetNodeState();
assertNotNull(result);
*
* @throws Exception
*
-
+
*/
-
+
public void testGetSndSetToolTip()
throws Exception {
TraceControlComponent fixture = new TraceControlComponent("", new TraceControlRoot());
/**********************************************************************
* 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.lttng2.ui.tests.control.model.component;
* The class <code>TraceControlKernelProviderTests</code> contains UST provider handling
* test cases.
*/
-@SuppressWarnings("nls")
+@SuppressWarnings({"nls", "javadoc"})
public class TraceControlKernelProviderTests extends TestCase {
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
private TraceControlTestFacility fFacility;
private TestRemoteSystemProxy fProxy;
- private String fTestFile;
-
+ private String fTestFile;
+
// ------------------------------------------------------------------------
// Static methods
// ------------------------------------------------------------------------
/**
* Returns test setup used when executing test case stand-alone.
- * @return Test setup class
+ * @return Test setup class
*/
public static Test suite() {
return new ModelImplTestSetup(new TestSuite(TraceControlKernelProviderTests.class));
public void tearDown() throws Exception {
fFacility.waitForJobs();
}
-
+
/**
* Run the TraceControlComponent.
*/
public void testKernelProviderTree() 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);
ITraceControlComponent[] providers = groups[0].getChildren();
KernelProviderComponent kernelProvider = (KernelProviderComponent) providers[0];
- // Get kernel provider events and select 2 events
+ // Get kernel provider events and select 2 events
ITraceControlComponent[] events = kernelProvider.getChildren();
assertNotNull(events);
assertEquals(3, events.length);
// Initialize session handling scenario
fProxy.setScenario(TraceControlTestFacility.SCEN_SCENARIO_SESSION_HANDLING);
-
+
// ------------------------------------------------------------------------
// Create session
// ------------------------------------------------------------------------
TraceSessionComponent session = fFacility.createSession(groups[1]);
-
+
// Verify that session was created
assertNotNull(session);
assertEquals("mysession", session.getName());
ITraceControlComponent[] components = { baseEventInfo0, baseEventInfo1 };
fFacility.executeCommand(components, "assign.event");
-
+
// Verify that kernel domain was created
ITraceControlComponent[] domains = session.getChildren();
assertNotNull(domains);
assertEquals(1, domains.length);
assertEquals("Kernel", domains[0].getName());
-
+
// Verify that channel0 was created with default values
ITraceControlComponent[] channels = domains[0].getChildren();
assertNotNull(channels);
assertEquals(1, channels.length);
assertTrue(channels[0] instanceof TraceChannelComponent);
- TraceChannelComponent channel = (TraceChannelComponent) channels[0];
+ TraceChannelComponent channel = (TraceChannelComponent) channels[0];
assertEquals("channel0", channel.getName());
assertEquals(4, channel.getNumberOfSubBuffers());
assertEquals("splice()", channel.getOutputType());
assertEquals(TraceEnablement.ENABLED, event1.getState());
// ------------------------------------------------------------------------
- // Disable event components
+ // Disable event components
// ------------------------------------------------------------------------
ITraceControlComponent[] selection = { event, event1 };
fFacility.executeCommand(selection, "disableEvent");
-
+
assertEquals(TraceEnablement.DISABLED, event.getState());
assertEquals(TraceEnablement.DISABLED, event1.getState());
// ------------------------------------------------------------------------
- // Enable event component
+ // Enable event component
// ------------------------------------------------------------------------
fFacility.executeCommand(event1, "enableEvent");
-
+
// Verify event state
assertEquals(TraceEnablement.ENABLED, event1.getState());
-
+
// ------------------------------------------------------------------------
- // Destroy session
+ // Destroy session
// ------------------------------------------------------------------------
// Initialize session handling scenario
fProxy.setScenario(TraceControlTestFacility.SCEN_SCENARIO_SESSION_HANDLING);
-
+
fFacility.destroySession(session);
-
+
// Verify that no more session components exist
assertEquals(0, groups[1].getChildren().length);
//-------------------------------------------------------------------------
fFacility.executeCommand(node, "disconnect");
assertEquals(TargetNodeState.DISCONNECTED, node.getTargetNodeState());
-
+
//-------------------------------------------------------------------------
// Delete node
//-------------------------------------------------------------------------
/**********************************************************************
* 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.lttng2.ui.tests.control.model.component;
* handling test cases.
*/
-@SuppressWarnings("nls")
+@SuppressWarnings({"nls", "javadoc"})
public class TraceControlKernelSessionTests extends TestCase {
-
+
// ------------------------------------------------------------------------
// Constants
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
private TraceControlTestFacility fFacility;
private TestRemoteSystemProxy fProxy;
- private String fTestFile;
-
+ private String fTestFile;
+
// ------------------------------------------------------------------------
// Static methods
// ------------------------------------------------------------------------
/**
* Returns test setup used when executing test case stand-alone.
- * @return Test setup class
+ * @return Test setup class
*/
public static Test suite() {
return new ModelImplTestSetup(new TestSuite(TraceControlKernelSessionTests.class));
public void tearDown() throws Exception {
fFacility.waitForJobs();
}
-
+
/**
* Run the TraceControlComponent.
*/
public void testTraceSessionTree() throws Exception {
-
+
fProxy.setTestFile(fTestFile);
fProxy.setScenario(TraceControlTestFacility.SCEN_INIT_TEST);
-
+
ITraceControlComponent root = TraceControlTestFacility.getInstance().getControlView().getTraceControlRoot();
ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
TraceControlDialogFactory.getInstance().setCreateSessionDialog(new CreateSessionDialogStub());
TraceControlDialogFactory.getInstance().setGetEventInfoDialog(new GetEventInfoDialogStub());
TraceControlDialogFactory.getInstance().setConfirmDialog(new DestroyConfirmDialogStub());
-
+
// Initialize session handling scenario
fProxy.setScenario(TraceControlTestFacility.SCEN_SCENARIO_SESSION_HANDLING);
-
+
// ------------------------------------------------------------------------
// Create session
// ------------------------------------------------------------------------
TraceSessionComponent session = fFacility.createSession(groups[1]);
-
+
// Verify that session was created
assertNotNull(session);
assertEquals("mysession", session.getName());
// Initialize scenario
fProxy.setScenario(SCEN_SCENARIO3_TEST);
-
+
// ------------------------------------------------------------------------
// Enable channel on session
// ------------------------------------------------------------------------
TraceControlDialogFactory.getInstance().setEnableChannelDialog(channelStub);
fFacility.executeCommand(session, "enableChannelOnSession");
-
+
// Verify that Kernel domain was created
ITraceControlComponent[] domains = session.getChildren();
assertNotNull(domains);
assertEquals(1, domains.length);
assertEquals("Kernel", domains[0].getName());
-
+
// Verify that channel was created with correct data
ITraceControlComponent[] channels = domains[0].getChildren();
assertNotNull(channels);
assertEquals(1, channels.length);
assertTrue(channels[0] instanceof TraceChannelComponent);
- TraceChannelComponent channel = (TraceChannelComponent) channels[0];
+ TraceChannelComponent channel = (TraceChannelComponent) channels[0];
assertEquals("mychannel", channel.getName());
assertEquals(4, channel.getNumberOfSubBuffers());
assertEquals("splice()", channel.getOutputType());
info.setSwitchTimer(100);
info.setReadTimer(200);
channelStub.setChannelInfo(info);
-
+
fFacility.executeCommand(domains[0], "enableChannelOnDomain");
-
+
// Get Kernel domain component instance
domains = session.getChildren();
assertNotNull(domains);
assertEquals(2, channels.length);
assertTrue(channels[1] instanceof TraceChannelComponent);
- channel = (TraceChannelComponent) channels[1];
+ channel = (TraceChannelComponent) channels[1];
assertEquals("mychannel2", channel.getName());
assertEquals(2, channel.getNumberOfSubBuffers());
assertEquals("splice()", channel.getOutputType());
eventsDialogStub.setNames(events);
eventsDialogStub.setIsKernel(true);
TraceControlDialogFactory.getInstance().setEnableEventsDialog(eventsDialogStub);
-
+
// ------------------------------------------------------------------------
- // disable channels
+ // disable channels
// ------------------------------------------------------------------------
// Get Kernel domain component instance
domains = session.getChildren();
assertEquals(2, channels.length);
fFacility.executeCommand(channels, "disableChannel");
-
+
assertEquals(TraceEnablement.DISABLED, ((TraceChannelComponent)channels[0]).getState());
assertEquals(TraceEnablement.DISABLED, ((TraceChannelComponent)channels[1]).getState());
// ------------------------------------------------------------------------
- // enable channels
+ // enable channels
// ------------------------------------------------------------------------
// Get Kernel domain component instance
domains = session.getChildren();
channels = domains[0].getChildren();
assertNotNull(channels);
assertEquals(2, channels.length);
-
+
fFacility.executeCommand(channels, "enableChannel");
-
+
assertEquals(TraceEnablement.ENABLED, ((TraceChannelComponent)channels[0]).getState());
assertEquals(TraceEnablement.ENABLED, ((TraceChannelComponent)channels[1]).getState());
// ------------------------------------------------------------------------
- // enable event (tracepoints) on session
+ // enable event (tracepoints) on session
// ------------------------------------------------------------------------
fFacility.executeCommand(session, "enableEventOnSession");
assertEquals(3, channels.length);
assertTrue(channels[2] instanceof TraceChannelComponent);
- channel = (TraceChannelComponent) channels[2];
+ channel = (TraceChannelComponent) channels[2];
assertEquals("channel0", channel.getName());
// No need to check parameters of default channel because that has been done in other tests
ITraceControlComponent[] channel0Events = channel.getChildren();
assertEquals(2, channel0Events.length);
-
+
assertTrue(channel0Events[0] instanceof TraceEventComponent);
assertTrue(channel0Events[1] instanceof TraceEventComponent);
assertEquals(TraceEnablement.ENABLED, event.getState());
// ------------------------------------------------------------------------
- // enable event (tracepoints) on domain
+ // enable event (tracepoints) on domain
// ------------------------------------------------------------------------
events.clear();
events.add("sched_wakeup_new");
// Verify that channel was created with correct data
channels = domains[0].getChildren();
- channel = (TraceChannelComponent) channels[2];
+ channel = (TraceChannelComponent) channels[2];
// No need to check parameters of default channel because that has been done in other tests
channel = (TraceChannelComponent) channels[2];
-
+
channel0Events = channel.getChildren();
assertEquals(3, channel0Events.length);
-
+
assertTrue(channel0Events[2] instanceof TraceEventComponent);
event = (TraceEventComponent) channel0Events[2];
assertEquals(TraceEnablement.ENABLED, event.getState());
// ------------------------------------------------------------------------
- // enable event (tracepoints) on channel
+ // enable event (tracepoints) on channel
// ------------------------------------------------------------------------
events.clear();
eventsDialogStub.setNames(events);
eventsDialogStub.setIsAllTracePoints(true);
fFacility.executeCommand(channels[1], "enableEventOnChannel");
-
+
// Get Kernel domain component instance
domains = session.getChildren();
assertNotNull(domains);
channels = domains[0].getChildren();
// No need to check parameters of default channel because that has been done in other tests
channel = (TraceChannelComponent) channels[1];
-
+
channel0Events = channel.getChildren();
assertEquals(3, channel0Events.length);
-
+
assertTrue(channel0Events[0] instanceof TraceEventComponent);
assertTrue(channel0Events[1] instanceof TraceEventComponent);
assertTrue(channel0Events[2] instanceof TraceEventComponent);
assertEquals(TraceLogLevel.TRACE_EMERG, event.getLogLevel());
assertEquals(TraceEventType.TRACEPOINT, event.getEventType());
assertEquals(TraceEnablement.ENABLED, event.getState());
-
+
event = (TraceEventComponent) channel0Events[2];
assertEquals("sched_wakeup_new", event.getName());
assertEquals(TraceLogLevel.TRACE_EMERG, event.getLogLevel());
assertEquals(TraceEnablement.ENABLED, event.getState());
// ------------------------------------------------------------------------
- // enable event (syscall) on channel
+ // enable event (syscall) on channel
// ------------------------------------------------------------------------
events.clear();
- eventsDialogStub.setIsTracePoints(false);
+ eventsDialogStub.setIsTracePoints(false);
eventsDialogStub.setIsAllTracePoints(false);
eventsDialogStub.setIsSysCalls(true);
fFacility.executeCommand(channels[0], "enableEventOnChannel");
-
+
// Get Kernel domain component instance
domains = session.getChildren();
assertNotNull(domains);
// Verify that channel was created with correct data
channels = domains[0].getChildren();
- channel = (TraceChannelComponent) channels[0];
+ channel = (TraceChannelComponent) channels[0];
// No need to check parameters of default channel because that has been done in other tests
channel = (TraceChannelComponent) channels[0];
-
+
channel0Events = channel.getChildren();
assertEquals(1, channel0Events.length);
-
+
assertTrue(channel0Events[0] instanceof TraceEventComponent);
-
+
event = (TraceEventComponent) channel0Events[0];
assertEquals("syscalls", event.getName());
assertEquals(TraceLogLevel.LEVEL_UNKNOWN, event.getLogLevel());
assertEquals(TraceEnablement.ENABLED, event.getState());
// ------------------------------------------------------------------------
- // enable event (syscall) on domain
+ // enable event (syscall) on domain
// ------------------------------------------------------------------------
fFacility.executeCommand(domains[0], "enableEventOnDomain");
// Verify that channel was created with correct data
channels = domains[0].getChildren();
- channel = (TraceChannelComponent) channels[0];
+ channel = (TraceChannelComponent) channels[0];
// No need to check parameters of default channel because that has been done in other tests
channel = (TraceChannelComponent) channels[2];
-
+
channel0Events = channel.getChildren();
assertEquals(4, channel0Events.length);
-
+
assertTrue(channel0Events[0] instanceof TraceEventComponent);
-
+
event = (TraceEventComponent) channel0Events[0];
assertEquals("syscalls", event.getName());
assertEquals(TraceLogLevel.LEVEL_UNKNOWN, event.getLogLevel());
assertEquals(TraceEnablement.ENABLED, event.getState());
// ------------------------------------------------------------------------
- // enable event (syscall) on session
+ // enable event (syscall) on session
// ------------------------------------------------------------------------
fFacility.executeCommand(session, "enableEventOnSession");
// Verify that channel was created with correct data
channels = domains[0].getChildren();
- channel = (TraceChannelComponent) channels[0];
+ channel = (TraceChannelComponent) channels[0];
// No need to check parameters of default channel because that has been done in other tests
channel = (TraceChannelComponent) channels[2];
-
+
channel0Events = channel.getChildren();
assertEquals(4, channel0Events.length);
-
+
assertTrue(channel0Events[0] instanceof TraceEventComponent);
-
+
event = (TraceEventComponent) channel0Events[0];
assertEquals("syscalls", event.getName());
assertEquals(TraceLogLevel.LEVEL_UNKNOWN, event.getLogLevel());
assertEquals(TraceEventType.SYSCALL, event.getEventType());
assertEquals(TraceEnablement.ENABLED, event.getState());
-
+
// ------------------------------------------------------------------------
- // enable event (dynamic probe) on domain
+ // enable event (dynamic probe) on domain
// ------------------------------------------------------------------------
events.clear();
eventsDialogStub.setIsSysCalls(false);
eventsDialogStub.setIsDynamicProbe(true);
eventsDialogStub.setDynamicProbe("0xc0101280");
eventsDialogStub.setProbeEventName("myevent1");
-
+
fFacility.executeCommand(domains[0], "enableEventOnDomain");
-
+
// Get Kernel domain component instance
domains = session.getChildren();
assertNotNull(domains);
// Verify that channel was created with correct data
channels = domains[0].getChildren();
- channel = (TraceChannelComponent) channels[2];
+ channel = (TraceChannelComponent) channels[2];
// No need to check parameters of default channel because that has been done in other tests
channel0Events = channel.getChildren();
assertEquals(5, channel0Events.length);
-
+
assertTrue(channel0Events[0] instanceof TraceProbeEventComponent);
-
+
TraceProbeEventComponent probeEvent = (TraceProbeEventComponent) channel0Events[0];
assertEquals("myevent1", probeEvent.getName());
assertEquals(TraceLogLevel.LEVEL_UNKNOWN, probeEvent.getLogLevel());
assertNull(probeEvent.getSymbol());
// ------------------------------------------------------------------------
- // enable event (dynamic probe) on channel
+ // enable event (dynamic probe) on channel
// ------------------------------------------------------------------------
eventsDialogStub.setIsDynamicProbe(true);
eventsDialogStub.setDynamicProbe("init_post");
eventsDialogStub.setProbeEventName("myevent2");
fFacility.executeCommand(channels[2], "enableEventOnChannel");
-
+
// Get Kernel domain component instance
domains = session.getChildren();
assertNotNull(domains);
// Verify that channel was created with correct data
channels = domains[0].getChildren();
- channel = (TraceChannelComponent) channels[2];
+ channel = (TraceChannelComponent) channels[2];
// No need to check parameters of default channel because that has been done in other tests
channel0Events = channel.getChildren();
assertEquals(6, channel0Events.length);
-
+
assertTrue(channel0Events[0] instanceof TraceProbeEventComponent);
-
+
probeEvent = (TraceProbeEventComponent) channel0Events[0];
assertEquals("myevent2", probeEvent.getName());
assertEquals(TraceLogLevel.LEVEL_UNKNOWN, probeEvent.getLogLevel());
assertEquals("init_post", probeEvent.getSymbol());
// ------------------------------------------------------------------------
- // enable event (dynamic probe) on session
+ // enable event (dynamic probe) on session
// ------------------------------------------------------------------------
eventsDialogStub.setIsDynamicProbe(true);
eventsDialogStub.setDynamicProbe("init_post:0x1000");
eventsDialogStub.setProbeEventName("myevent3");
fFacility.executeCommand(session, "enableEventOnSession");
-
+
// Get Kernel domain component instance
domains = session.getChildren();
assertNotNull(domains);
// Verify that channel was created with correct data
channels = domains[0].getChildren();
- channel = (TraceChannelComponent) channels[2];
+ channel = (TraceChannelComponent) channels[2];
// No need to check parameters of default channel because that has been done in other tests
channel0Events = channel.getChildren();
assertEquals("0x1000", probeEvent.getOffset());
assertNull(null, probeEvent.getAddress());
assertEquals("init_post", probeEvent.getSymbol());
-
+
// ------------------------------------------------------------------------
// enable event (dynamic function probe) on session
// ------------------------------------------------------------------------
eventsDialogStub.setFunctionProbe("create_dev");
fFacility.executeCommand(session, "enableEventOnSession");
-
+
// Get Kernel domain component instance
domains = session.getChildren();
assertNotNull(domains);
// Verify that channel was created with correct data
channels = domains[0].getChildren();
- channel = (TraceChannelComponent) channels[2];
+ channel = (TraceChannelComponent) channels[2];
// No need to check parameters of default channel because that has been done in other tests
channel0Events = channel.getChildren();
assertEquals("0x0", probeEvent.getOffset());
assertNull(null, probeEvent.getAddress());
assertEquals("create_dev", probeEvent.getSymbol());
-
+
// ------------------------------------------------------------------------
// enable event (dynamic function probe) on domain
// ------------------------------------------------------------------------
eventsDialogStub.setFunctionProbe("create_dev:0x2000");
fFacility.executeCommand(domains[0], "enableEventOnDomain");
-
+
// Get Kernel domain component instance
domains = session.getChildren();
assertNotNull(domains);
// Verify that channel was created with correct data
channels = domains[0].getChildren();
- channel = (TraceChannelComponent) channels[2];
+ channel = (TraceChannelComponent) channels[2];
// No need to check parameters of default channel because that has been done in other tests
channel0Events = channel.getChildren();
eventsDialogStub.setFunctionProbe("create_dev:0x2000");
fFacility.executeCommand(channels[0], "enableEventOnChannel");
-
+
// Get Kernel domain component instance
domains = session.getChildren();
assertNotNull(domains);
// Verify that channel was created with correct data
channels = domains[0].getChildren();
- channel = (TraceChannelComponent) channels[0];
+ channel = (TraceChannelComponent) channels[0];
// No need to check parameters of default channel because that has been done in other tests
channel0Events = channel.getChildren();
assertEquals("create_dev", probeEvent.getSymbol());
// ------------------------------------------------------------------------
- // Add Context on domain
+ // Add Context on domain
// ------------------------------------------------------------------------
// Get Kernel domain component instance
domains = session.getChildren();
contexts.add("perf:cache-misses");
addContextStub.setContexts(contexts);
TraceControlDialogFactory.getInstance().setAddContextDialog(addContextStub);
-
+
fFacility.executeCommand(domains[0], "addContextOnDomain");
// Currently there is nothing to verify because the list commands don't show any context information
// However, the execution of the command make sure that the correct service command line is build and executed.
// ------------------------------------------------------------------------
- // Add Context on channel
+ // Add Context on channel
// ------------------------------------------------------------------------
// Get Kernel domain component instance
//Verify that channel was created with correct data
channels = domains[0].getChildren();
- channel = (TraceChannelComponent) channels[0];
-
+ channel = (TraceChannelComponent) channels[0];
+
try {
// The setContext() verifies that the contexts set are part of the available contexts
// The available contexts are set by the command handler addContextOnDomain above.
fFacility.executeCommand(channel, "addContextOnChannel");
// Currently there is nothing to verify because the list commands don't show any context information
// However, the execution of the command make sure that the correct service command line is build and executed.
-
+
// ------------------------------------------------------------------------
- // Add Context on event
+ // Add Context on event
// ------------------------------------------------------------------------
// Get Kernel domain component instance
domains = session.getChildren();
//Verify that channel was created with correct data
channels = domains[0].getChildren();
- channel = (TraceChannelComponent) channels[2];
-
+ channel = (TraceChannelComponent) channels[2];
+
channel0Events = channel.getChildren();
event = (TraceEventComponent) channel0Events[6];
-
+
fFacility.executeCommand(event, "addContextOnEvent");
// Currently there is nothing to verify because the list commands don't show any context information
- // However, the execution of the command make sure that the correct service command line is build and executed.
+ // However, the execution of the command make sure that the correct service command line is build and executed.
// ------------------------------------------------------------------------
- // Calibrate
+ // Calibrate
// ------------------------------------------------------------------------
// Get Kernel domain component instance
domains = session.getChildren();
assertNotNull(domains);
assertEquals(1, domains.length);
-
+
fFacility.executeCommand(domains[0], "calibrate");
- // There is nothing to verify here.
+ // There is nothing to verify here.
// However, the execution of the command make sure that the correct service command line is build and executed.
-
+
// ------------------------------------------------------------------------
- // refresh
+ // refresh
// ------------------------------------------------------------------------
fFacility.executeCommand(node, "refresh");
groups = node.getChildren();
assertEquals(1, groups[1].getChildren()[0].getChildren().length); // domains
assertEquals(3, groups[1].getChildren()[0].getChildren()[0].getChildren().length); // channels
assertEquals(2, groups[1].getChildren()[0].getChildren()[0].getChildren()[0].getChildren().length); // events (of channel[0])
-
+
// Initialize session handling scenario
fProxy.setScenario(TraceControlTestFacility.SCEN_SCENARIO_SESSION_HANDLING);
-
+
session = (TraceSessionComponent)groups[1].getChildren()[0];
// ------------------------------------------------------------------------
- // start session
+ // start session
// ------------------------------------------------------------------------
fFacility.startSession(session);
assertEquals(TraceSessionState.ACTIVE, session.getSessionState());
-
+
// ------------------------------------------------------------------------
- // stop session
+ // stop session
// ------------------------------------------------------------------------
fFacility.stopSession(session);
assertEquals(TraceSessionState.INACTIVE, session.getSessionState());
-
+
// ------------------------------------------------------------------------
- // Destroy session
+ // Destroy session
// ------------------------------------------------------------------------
fFacility.destroySession(session);
-
+
// Verify that no more session components exist
assertEquals(0, groups[1].getChildren().length);
//-------------------------------------------------------------------------
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
/**********************************************************************
* 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.lttng2.ui.tests.control.model.component;
private static final String TEST_STREAM = "ListInfoTest.cfg";
private static final String SCEN_LIST_INFO_TEST = "ListInfoTest";
-
+
// ------------------------------------------------------------------------
// Test data
// ------------------------------------------------------------------------
-
+
// ------------------------------------------------------------------------
// Static methods
// ------------------------------------------------------------------------
/**
* Returns test setup used when executing test case stand-alone.
- * @return Test setup class
+ * @return Test setup class
*/
public static Test suite() {
return new ModelImplTestSetup(new TestSuite(TraceControlPropertiesTest.class));
public void tearDown() throws Exception {
TraceControlTestFacility.getInstance().waitForJobs();
}
-
+
/**
* Run the TraceControlComponent.
+ *
+ * @throws Exception
+ * This will fail the test
*/
public void testComponentProperties() throws Exception {
-
+
TestRemoteSystemProxy proxy = new TestRemoteSystemProxy();
URL location = FileLocator.find(FrameworkUtil.getBundle(this.getClass()), new Path(DIRECTORY + File.separator + TEST_STREAM), null);
File testfile = new File(FileLocator.toFileURL(location).toURI());
proxy.setTestFile(testfile.getAbsolutePath());
proxy.setScenario(SCEN_LIST_INFO_TEST);
-
+
ITraceControlComponent root = TraceControlTestFacility.getInstance().getControlView().getTraceControlRoot();
ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
adapter = node.getAdapter(IChannelInfo.class);
assertNull(adapter);
-
+
ITraceControlComponent[] groups = node.getChildren();
assertNotNull(groups);
assertEquals(2, groups.length);
-
+
ITraceControlComponent[] providers = groups[0].getChildren();
assertNotNull(providers);
// Verify Kernel Provider Properties (adapter)
// ------------------------------------------------------------------------
KernelProviderComponent kernelProvider = (KernelProviderComponent) providers[0];
-
+
adapter = kernelProvider.getAdapter(IPropertySource.class);
assertNotNull(adapter);
assertTrue(adapter instanceof KernelProviderPropertySource);
// Verify UST Provider Properties (adapter)
// ------------------------------------------------------------------------
UstProviderComponent ustProvider = (UstProviderComponent) providers[1];
-
+
adapter = ustProvider.getAdapter(IPropertySource.class);
assertNotNull(adapter);
assertTrue(adapter instanceof UstProviderPropertySource);
BaseEventComponent baseEventInfo = (BaseEventComponent) events[0];
assertNotNull(baseEventInfo);
-
+
adapter = baseEventInfo.getAdapter(IPropertySource.class);
assertNotNull(adapter);
assertTrue(adapter instanceof BaseEventPropertySource);
assertNotNull(domainSource.getPropertyDescriptors());
assertEquals("Kernel", domainSource.getPropertyValue(TraceDomainPropertySource.TRACE_DOMAIN_NAME_PROPERTY_ID));
-
+
ITraceControlComponent[] channels = domains[0].getChildren();
assertNotNull(channels);
assertEquals(2, channels.length);
// ------------------------------------------------------------------------
assertTrue(channels[0] instanceof TraceChannelComponent);
TraceChannelComponent channel = (TraceChannelComponent) channels[0];
-
+
adapter = channel.getAdapter(IPropertySource.class);
assertNotNull(adapter);
assertTrue(adapter instanceof TraceChannelPropertySource);
assertEquals(String.valueOf(200), channelSource.getPropertyValue(TraceChannelPropertySource.TRACE_CHANNEL_READ_TIMER_PROPERTY_ID));
assertEquals(String.valueOf(262144), channelSource.getPropertyValue(TraceChannelPropertySource.TRACE_CHANNEL_SUBBUFFER_SIZE_PROPERTY_ID));
assertEquals(String.valueOf(0), channelSource.getPropertyValue(TraceChannelPropertySource.TRACE_CHANNEL_SWITCH_TIMER_PROPERTY_ID));
-
+
// ------------------------------------------------------------------------
// Verify Event Properties (adapter)
// ------------------------------------------------------------------------
assertNotNull(channel0Events);
assertEquals(5, channel0Events.length);
assertTrue(channel0Events[0] instanceof TraceEventComponent);
-
+
TraceEventComponent event = (TraceEventComponent) channel0Events[0];
-
+
adapter = event.getAdapter(IPropertySource.class);
assertNotNull(adapter);
assertTrue(adapter instanceof TraceEventPropertySource);
TraceEventPropertySource eventSource = (TraceEventPropertySource)adapter;
assertNotNull(eventSource.getPropertyDescriptors());
-
+
assertEquals("block_rq_remap", eventSource.getPropertyValue(TraceEventPropertySource.TRACE_EVENT_NAME_PROPERTY_ID));
assertEquals(TraceLogLevel.TRACE_EMERG.name(), eventSource.getPropertyValue(TraceEventPropertySource.TRACE_EVENT_LOGLEVEL_PROPERTY_ID));
assertEquals(TraceEventType.TRACEPOINT.name(), eventSource.getPropertyValue(TraceEventPropertySource.TRACE_EVENT_TYPE_PROPERTY_ID));
assertEquals(TraceEnablement.ENABLED.name(), eventSource.getPropertyValue(TraceEventPropertySource.TRACE_EVENT_STATE_PROPERTY_ID));
-
+
// ------------------------------------------------------------------------
// Verify Probe Event Properties (adapter)
// ------------------------------------------------------------------------
assertTrue(channel0Events[2] instanceof TraceProbeEventComponent);
-
+
TraceProbeEventComponent probeEvent = (TraceProbeEventComponent) channel0Events[2];
-
+
adapter = probeEvent.getAdapter(IPropertySource.class);
assertNotNull(adapter);
assertTrue(adapter instanceof TraceProbeEventPropertySource);
TraceProbeEventPropertySource probeEventSource = (TraceProbeEventPropertySource)adapter;
assertNotNull(probeEventSource.getPropertyDescriptors());
assertEquals(4, probeEventSource.getPropertyDescriptors().length);
-
+
assertEquals("myevent2", probeEventSource.getPropertyValue(TraceEventPropertySource.TRACE_EVENT_NAME_PROPERTY_ID));
assertEquals(TraceEventType.PROBE.name(), probeEventSource.getPropertyValue(TraceEventPropertySource.TRACE_EVENT_TYPE_PROPERTY_ID));
assertEquals(TraceEnablement.ENABLED.name(), probeEventSource.getPropertyValue(TraceEventPropertySource.TRACE_EVENT_STATE_PROPERTY_ID));
assertEquals("0xc0101340", probeEventSource.getPropertyValue(TraceProbeEventPropertySource.TRACE_EVENT_PROBE_ADDRESS_PROPERTY_ID));
-
+
assertTrue(channel0Events[3] instanceof TraceProbeEventComponent);
-
+
probeEvent = (TraceProbeEventComponent) channel0Events[3];
-
+
adapter = probeEvent.getAdapter(IPropertySource.class);
assertNotNull(adapter);
assertTrue(adapter instanceof TraceProbeEventPropertySource);
probeEventSource = (TraceProbeEventPropertySource)adapter;
assertNotNull(probeEventSource.getPropertyDescriptors());
assertEquals(5, probeEventSource.getPropertyDescriptors().length);
-
+
assertEquals("myevent0", probeEventSource.getPropertyValue(TraceEventPropertySource.TRACE_EVENT_NAME_PROPERTY_ID));
assertEquals(TraceEventType.PROBE.name(), probeEventSource.getPropertyValue(TraceEventPropertySource.TRACE_EVENT_TYPE_PROPERTY_ID));
assertEquals(TraceEnablement.ENABLED.name(), probeEventSource.getPropertyValue(TraceEventPropertySource.TRACE_EVENT_STATE_PROPERTY_ID));
assertEquals("0x0", probeEventSource.getPropertyValue(TraceProbeEventPropertySource.TRACE_EVENT_PROBE_OFFSET_PROPERTY_ID));
assertEquals("init_post", probeEventSource.getPropertyValue(TraceProbeEventPropertySource.TRACE_EVENT_PROBE_SYMBOL_PROPERTY_ID));
-
+
//-------------------------------------------------------------------------
// Delete node
//-------------------------------------------------------------------------
/*******************************************************************************
* Copyright (c) 2011 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
*******************************************************************************/
/**
* Singleton class to facilitate the test cases. Creates UML2SD view and loader objects as well as provides
- * utility methods for interacting with the loader/view.
+ * utility methods for interacting with the loader/view.
*/
+@SuppressWarnings("javadoc")
public class TraceControlTestFacility {
// ------------------------------------------------------------------------
// Constants
// ------------------------------------------------------------------------
- public final static int WAIT_FOR_JOBS_DELAY = 1000;
+ public final static int WAIT_FOR_JOBS_DELAY = 1000;
public final static int GUI_REFESH_DELAY = 500;
-
+
public final static String DIRECTORY = "testfiles"; //$NON-NLS-1$
public final static String COMMAND_CATEGORY_PREFIX = "org.eclipse.linuxtools.internal.lttng2.ui.commands.control."; //$NON-NLS-1$
public final static String SCEN_INIT_TEST = "Initialize"; //$NON-NLS-1$
public final static String SCEN_SCENARIO_SESSION_HANDLING = "SessionHandling"; //$NON-NLS-1$
public final static String SCEN_SCENARIO_SESSION_HANDLING_WITH_PATH = "SessionHandlingWithPath"; //$NON-NLS-1$
-
+
// ------------------------------------------------------------------------
// Attributes
// ------------------------------------------------------------------------
private static TraceControlTestFacility fInstance = null;
private ControlView fControlView = null;
private boolean fIsInitialized = false;
-
+
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
* Initial the test facility.
*/
public void init() {
-
+
if (!fIsInitialized) {
IViewPart view;
try {
-
+
view = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow()
.getActivePage()
.findView("org.eclipse.ui.internal.introview"); //$NON-NLS-1$
-
+
if (view != null) {
PlatformUI.getWorkbench()
.getActiveWorkbenchWindow()
- .getActivePage().hideView(view);
+ .getActivePage().hideView(view);
}
view = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow()
.getActivePage()
- .showView(ControlView.ID);
-
+ .showView(ControlView.ID);
+
} catch (PartInitException e) {
throw new RuntimeException(e);
}
}
}
-
+
/**
* Disposes the facility (and GUI)
*/
setSelection(component);
executeCommand(commandId);
}
-
+
/**
* Executes an Eclipse command with command ID after selecting passed components
* @param components - array of components to select in the tree
waitForJobs();
}
-
+
/**
* Selects passed components
* @param components - array of component to select in the tree
// Selection is done in own job
waitForJobs();
}
-
+
/**
* Creates session on passed session group.
* @param group - session group
@SuppressWarnings("nls")
public TraceSessionComponent createSession(ITraceControlComponent group) throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException {
executeCommand(group, "createSession");
-
+
ITraceControlComponent[] sessions = group.getChildren();
if ((sessions == null) || (sessions.length == 0)) {
return null;
}
return (TraceSessionComponent)sessions[0];
}
-
+
/**
* Destroys a given session.
* @param session - session to destroy
public void destroySession(TraceSessionComponent session) throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException {
executeCommand(session, "destroySession");
}
-
+
/**
* Starts a given session
* @param session - session to start
public void startSession(TraceSessionComponent session) throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException {
executeCommand(session, "start");
}
-
+
/**
* Stops a given session
* @param session - session to stop
/**********************************************************************
* 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.lttng2.ui.tests.control.model.component;
*/
@SuppressWarnings("nls")
public class TraceControlTreeModelTest extends TestCase {
-
+
// ------------------------------------------------------------------------
// Constants
// ------------------------------------------------------------------------
private static final String TEST_STREAM = "ListInfoTest.cfg";
private static final String SCEN_LIST_INFO_TEST = "ListInfoTest";
private static final String TARGET_NODE_NAME = "myNode";
-
+
// ------------------------------------------------------------------------
// Test data
// ------------------------------------------------------------------------
-
+
private TestRemoteSystemProxy fProxy;
- private String fTestFile;
-
+ private String fTestFile;
+
// ------------------------------------------------------------------------
// Static methods
// ------------------------------------------------------------------------
/**
* Returns test setup used when executing test case stand-alone.
- * @return Test setup class
+ * @return Test setup class
*/
public static Test suite() {
return new ModelImplTestSetup(new TestSuite(TraceControlTreeModelTest.class));
public void tearDown() throws Exception {
TraceControlTestFacility.getInstance().waitForJobs();
}
-
+
/**
* Run the TraceControlComponent.
+ *
+ * @throws Exception
+ * This will fail the test
*/
- public void testTraceControlComponents()
- throws Exception {
-
+ public void testTraceControlComponents() throws Exception {
+
fProxy.setTestFile(fTestFile);
fProxy.setScenario(SCEN_LIST_INFO_TEST);
-
+
ITraceControlComponent root = TraceControlTestFacility.getInstance().getControlView().getTraceControlRoot();
ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
ITraceControlComponent[] groups = node.getChildren();
assertNotNull(groups);
assertEquals(2, groups.length);
-
+
assertTrue(groups[0] instanceof TraceProviderGroup);
assertTrue(groups[1] instanceof TraceSessionGroup);
-
+
assertEquals("Provider", groups[0].getName());
assertEquals("Sessions", groups[1].getName());
ustProvider = (UstProviderComponent) providers[2];
assertEquals("/home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello [PID=4852]", ustProvider.getName());
assertEquals(4852, ustProvider.getPid());
-
+
// verify getters and setter
verifyUstProviderGettersSetters(ustProvider);
assertEquals("ust_tests_hello:tptest", baseEventInfo.getName());
assertEquals(TraceLogLevel.TRACE_DEBUG_FUNCTION, baseEventInfo.getLogLevel());
assertEquals(TraceEventType.TRACEPOINT, baseEventInfo.getEventType());
-
+
// verify getters and setters
verifyBaseEventGettersSetters(baseEventInfo);
-
+
// ------------------------------------------------------------------------
// Verify TraceSessionGroup
// ------------------------------------------------------------------------
// Verify setters and setters
verifySessionGetterSetters(session);
-
+
ITraceControlComponent[] domains = session.getChildren();
assertNotNull(domains);
assertEquals(2, domains.length);
-
+
// ------------------------------------------------------------------------
// Verify Kernel domain
// ------------------------------------------------------------------------
// Verify setters and setters
verifyDomainGettersSetters((TraceDomainComponent) domains[0]);
-
+
// ------------------------------------------------------------------------
// Verify Kernel's channel0
// ------------------------------------------------------------------------
assertTrue(channels[0] instanceof TraceChannelComponent);
- TraceChannelComponent channel = (TraceChannelComponent) channels[0];
+ TraceChannelComponent channel = (TraceChannelComponent) channels[0];
assertEquals("channel0", channel.getName());
assertEquals(4, channel.getNumberOfSubBuffers());
assertEquals("splice()", channel.getOutputType());
assertTrue(channel0Events[2] instanceof TraceProbeEventComponent);
assertTrue(channel0Events[3] instanceof TraceProbeEventComponent);
assertTrue(channel0Events[4] instanceof TraceEventComponent);
-
+
TraceEventComponent event = (TraceEventComponent) channel0Events[0];
assertEquals("block_rq_remap", event.getName());
assertEquals(TraceLogLevel.TRACE_EMERG, event.getLogLevel());
assertEquals(TraceEventType.TRACEPOINT, event.getEventType());
assertEquals(TraceEnablement.ENABLED, event.getState());
-
+
event = (TraceEventComponent) channel0Events[1];
assertEquals("block_bio_remap", event.getName());
assertEquals(TraceLogLevel.TRACE_EMERG, event.getLogLevel());
assertNull(probeEvent.getAddress());
assertEquals("0x0", probeEvent.getOffset());
assertEquals("init_post", probeEvent.getSymbol());
-
+
event = (TraceEventComponent) channel0Events[4];
assertEquals("syscalls", event.getName());
assertEquals(TraceLogLevel.LEVEL_UNKNOWN, event.getLogLevel());
assertEquals(TraceEventType.SYSCALL, event.getEventType());
assertEquals(TraceEnablement.ENABLED, event.getState());
-
+
// ------------------------------------------------------------------------
// Verify Kernel's channel1
// ------------------------------------------------------------------------
assertEquals("channel1", channels[1].getName());
- channel = (TraceChannelComponent) channels[1];
+ channel = (TraceChannelComponent) channels[1];
assertEquals(4, channel.getNumberOfSubBuffers());
assertEquals("splice()", channel.getOutputType());
assertEquals(true, channel.isOverwriteMode());
// Verify domain UST global
// ------------------------------------------------------------------------
assertEquals("UST global", domains[1].getName());
-
+
ITraceControlComponent[] ustChannels = domains[1].getChildren();
-
+
for (int i = 0; i < ustChannels.length; i++) {
assertTrue(ustChannels[i] instanceof TraceChannelComponent);
}
// ------------------------------------------------------------------------
// Verify UST global's mychannel1
// ------------------------------------------------------------------------
- channel = (TraceChannelComponent) ustChannels[0];
+ channel = (TraceChannelComponent) ustChannels[0];
assertEquals("mychannel1", channel.getName());
assertEquals(8, channel.getNumberOfSubBuffers());
assertEquals("mmap()", channel.getOutputType());
assertEquals(TraceEnablement.DISABLED, channel.getState());
assertEquals(8192, channel.getSubBufferSize());
assertEquals(200, channel.getSwitchTimer());
-
- // verify getters and setters
+
+ // verify getters and setters
verifyChannelGettersSetters(channel);
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
ustEvents = channel.getChildren();
assertEquals(2, ustEvents.length);
-
+
event = (TraceEventComponent) ustEvents[0];
assertEquals("ust_tests_hello:tptest_sighandler", event.getName());
assertEquals(TraceLogLevel.TRACE_DEBUG_LINE, event.getLogLevel());
assertEquals(TraceEventType.TRACEPOINT, event.getEventType());
assertEquals(TraceEnablement.DISABLED, event.getState());
-
+
event = (TraceEventComponent) ustEvents[1];
assertEquals("*", ustEvents[1].getName());
assertEquals(TraceLogLevel.LEVEL_UNKNOWN, event.getLogLevel());
assertEquals(TraceEventType.TRACEPOINT, event.getEventType());
assertEquals(TraceEnablement.ENABLED, event.getState());
-
+
// verify getters and setters
verifyEventGettersSetters(event);
-
+
// disconnect
node.disconnect();
assertEquals(TargetNodeState.DISCONNECTED, node.getTargetNodeState());
assertNotNull(node.getImage());
assertNotSame(connectedImage, node.getImage());
-
+
node.getParent().removeChild(node);
}
-
+
private void verifySessionGetterSetters(TraceSessionComponent session) {
// save original values
String name = session.getName();
// test cases
session.setName("newName");
assertEquals("newName", session.getName());
-
+
session.setSessionPath("/home/user/tmp");
assertEquals("/home/user/tmp", session.getSessionPath());
assertEquals(TraceSessionState.INACTIVE, session.getSessionState());
Image inactiveImage = session.getImage();
assertNotNull(inactiveImage);
-
+
session.setSessionState("active");
assertEquals(TraceSessionState.ACTIVE, session.getSessionState());
for (int i = 0; i < domains.length; i++) {
assertEquals(domains[i].getName(), children[i].getName());
}
-
- // restore original values
+
+ // restore original values
session.setName(name);
session.setSessionPath(origPath);
session.setSessionState(origState);
}
-
+
private void verifyDomainGettersSetters(TraceDomainComponent domain) {
// save original values
boolean isKernel = domain.isKernel();
String name = event.getName();
TraceLogLevel level = event.getLogLevel();
TraceEventType type = event.getEventType();
-
+
// test cases
event.setName("newName");
assertEquals("newName", event.getName());
-
+
event.setLogLevel(TraceLogLevel.TRACE_INFO);
assertEquals(TraceLogLevel.TRACE_INFO, event.getLogLevel());
event.setLogLevel("TRACE_ALERT");
assertEquals(TraceEventType.UNKNOWN, event.getEventType());
event.setEventType("tracepoint");
assertEquals(TraceEventType.TRACEPOINT, event.getEventType());
-
+
// restore original values
event.setName(name);
event.setLogLevel(level);
event.setEventType(type);
}
-
+
private void verifyEventGettersSetters(TraceEventComponent event) {
// save original values
String name = event.getName();
TraceLogLevel level = event.getLogLevel();
TraceEventType type = event.getEventType();
TraceEnablement state = event.getState();
-
+
// test cases
event.setName("newName");
assertEquals("newName", event.getName());
-
+
event.setLogLevel(TraceLogLevel.TRACE_INFO);
assertEquals(TraceLogLevel.TRACE_INFO, event.getLogLevel());
event.setLogLevel("TRACE_ALERT");
assertEquals(TraceEventType.UNKNOWN, event.getEventType());
event.setEventType("tracepoint");
assertEquals(TraceEventType.TRACEPOINT, event.getEventType());
-
+
event.setState("disabled");
assertEquals(TraceEnablement.DISABLED, event.getState());
-
+
Image disabledImage = event.getImage();
assertNotNull(disabledImage);
event.setEventType(type);
event.setState(state);
}
-
+
private void verifyProbeEventGettersSetters(TraceProbeEventComponent event) {
// save original values
String address = event.getAddress();
String offset = event.getOffset();
String symbol = event.getSymbol();
-
+
// test cases
event.setAddress("0xffff1234");
assertEquals("0xffff1234", event.getAddress());
-
+
event.setOffset("0x1234");
assertEquals("0x1234", event.getOffset());
-
+
event.setSymbol("init");
assertEquals("init", event.getSymbol());
-
+
// restore original values
event.setAddress(address);
event.setOffset(offset);
event.setSymbol(symbol);
}
-
+
private void verifyChannelGettersSetters(TraceChannelComponent channel) {
// save original values
String name = channel.getName();
TraceEnablement state = channel.getState();
long subBufferSize = channel.getSubBufferSize();
long switchTimer = channel.getSwitchTimer();
-
+
// test cases
channel.setName("newName");
assertEquals("newName", channel.getName());
-
+
channel.setNumberOfSubBuffers(2);
assertEquals(2, channel.getNumberOfSubBuffers());
-
+
channel.setOutputType("splice()");
assertEquals("splice()", channel.getOutputType());
-
+
channel.setOverwriteMode(false);
assertEquals(false, channel.isOverwriteMode());
-
+
channel.setReadTimer(250);
assertEquals(250, channel.getReadTimer());
-
+
channel.setState("enabled");
assertEquals(TraceEnablement.ENABLED, channel.getState());
-
+
Image enabledImage = channel.getImage();
assertNotNull(enabledImage);
channel.setState(TraceEnablement.DISABLED);
Image disabledImage = channel.getImage();
assertNotNull(disabledImage);
assertNotSame(enabledImage, disabledImage);
-
+
channel.setSubBufferSize(1024);
assertEquals(1024, channel.getSubBufferSize());
-
+
channel.setSwitchTimer(1000);
assertEquals(1000, channel.getSwitchTimer());
channel.setSubBufferSize(subBufferSize);
channel.setSwitchTimer(switchTimer);
}
-
+
private void verifyUstProviderGettersSetters(UstProviderComponent ustProvider) {
// save original values
String name = ustProvider.getName();
int pid = ustProvider.getPid();
-
+
// test cases
ustProvider.setName("newName");
assertEquals("newName", ustProvider.getName());
ustProvider.setPid(9876);
assertEquals(9876, ustProvider.getPid());
-
+
// restore original values
ustProvider.setName(name);
ustProvider.setPid(pid);
/**********************************************************************
* 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.lttng2.ui.tests.control.model.component;
// ------------------------------------------------------------------------
private TraceControlTestFacility fFacility;
private TestRemoteSystemProxy fProxy;
- private String fTestFile;
-
+ private String fTestFile;
+
// ------------------------------------------------------------------------
// Static methods
// ------------------------------------------------------------------------
/**
* Returns test setup used when executing test case stand-alone.
- * @return Test setup class
+ * @return Test setup class
*/
public static Test suite() {
return new ModelImplTestSetup(new TestSuite(TraceControlUstProviderTests.class));
public void tearDown() throws Exception {
fFacility.waitForJobs();
}
-
+
/**
* Run the TraceControlComponent.
+ *
+ * @throws Exception
+ * This will fail the test
*/
public void testUstProviderTree() throws Exception {
-
+
fProxy.setTestFile(fTestFile);
fProxy.setScenario(TraceControlTestFacility.SCEN_INIT_TEST);
-
+
ITraceControlComponent root = TraceControlTestFacility.getInstance().getControlView().getTraceControlRoot();
ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
TargetNodeComponent node = new TargetNodeComponent("myNode", root, host, fProxy);
root.addChild(node);
-
+
fFacility.waitForJobs();
-
+
fFacility.executeCommand(node, "connect");
int i = 0;
i++;
fFacility.delay(TraceControlTestFacility.GUI_REFESH_DELAY);
}
-
+
// Verify that node is connected
assertEquals(TargetNodeState.CONNECTED, node.getTargetNodeState());
ITraceControlComponent[] providers = groups[0].getChildren();
KernelProviderComponent kernelProvider = (KernelProviderComponent) providers[0];
- // Get kernel provider events and select 2 events
+ // Get kernel provider events and select 2 events
ITraceControlComponent[] events = kernelProvider.getChildren();
assertNotNull(events);
assertEquals(3, events.length);
TraceControlDialogFactory.getInstance().setCreateSessionDialog(sessionDialogStub);
TraceSessionComponent session = fFacility.createSession(groups[1]);
-
+
// Verify that session was created
assertNotNull(session);
assertEquals("mysession", session.getName());
assertEquals("/home/user/temp", session.getSessionPath());
assertEquals(TraceSessionState.INACTIVE, session.getSessionState());
-
+
// ------------------------------------------------------------------------
// Enable Channel on UST global domain
// ------------------------------------------------------------------------
TraceControlDialogFactory.getInstance().setEnableChannelDialog(channelDialogStub);
fFacility.executeCommand(session, "enableChannelOnSession");
-
+
// Verify that UST domain was created
ITraceControlComponent[] domains = session.getChildren();
assertNotNull(domains);
assertEquals(1, domains.length);
assertEquals("UST global", domains[0].getName());
-
+
// Verify that channel was created with correct data
ITraceControlComponent[]channels = domains[0].getChildren();
assertNotNull(channels);
assertEquals(1, channels.length);
assertTrue(channels[0] instanceof TraceChannelComponent);
- TraceChannelComponent channel = (TraceChannelComponent) channels[0];
+ TraceChannelComponent channel = (TraceChannelComponent) channels[0];
assertEquals("mychannel", channel.getName());
assertEquals(2, channel.getNumberOfSubBuffers());
assertEquals("mmap()", channel.getOutputType());
ITraceControlComponent[] ustSelection = { baseEventInfo0, baseEventInfo1 };
fFacility.executeCommand(ustSelection, "assign.event");
-
+
// verify that events were created under the channel
// Note that domain and channel has to be re-read because the tree is re-created
assertEquals(TraceEnablement.ENABLED, event.getState());
// ------------------------------------------------------------------------
- // Disable event components
+ // Disable event components
// ------------------------------------------------------------------------
fFacility.executeCommand(event, "disableEvent");
-
+
assertEquals(TraceEnablement.DISABLED, event.getState());
// ------------------------------------------------------------------------
- // Enable event component
+ // Enable event component
// ------------------------------------------------------------------------
fFacility.executeCommand(event, "enableEvent");
// Verify event state
assertEquals(TraceEnablement.ENABLED, event.getState());
-
+
// ------------------------------------------------------------------------
- // Destroy session
+ // Destroy session
// ------------------------------------------------------------------------
// Initialize session handling scenario
fProxy.setScenario(TraceControlTestFacility.SCEN_SCENARIO_SESSION_HANDLING);
fFacility.destroySession(session);
-
+
// Verify that no more session components exist
assertEquals(0, groups[1].getChildren().length);
/**********************************************************************
* 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.lttng2.ui.tests.control.model.component;
// ------------------------------------------------------------------------
private TraceControlTestFacility fFacility;
private TestRemoteSystemProxy fProxy;
- private String fTestFile;
-
+ private String fTestFile;
+
// ------------------------------------------------------------------------
// Static methods
// ------------------------------------------------------------------------
/**
* Returns test setup used when executing test case stand-alone.
- * @return Test setup class
+ * @return Test setup class
*/
public static Test suite() {
return new ModelImplTestSetup(new TestSuite(TraceControlUstSessionTests.class));
public void tearDown() throws Exception {
fFacility.waitForJobs();
}
-
+
/**
* Run the TraceControlComponent.
+ *
+ * @throws Exception
+ * This will fail the 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();
// Initialize session handling scenario
fProxy.setScenario(TraceControlTestFacility.SCEN_SCENARIO_SESSION_HANDLING);
-
+
// ------------------------------------------------------------------------
// Create session
// ------------------------------------------------------------------------
TraceSessionComponent session = fFacility.createSession(groups[1]);
-
+
// Verify that session was created
assertNotNull(session);
assertEquals("mysession", session.getName());
// Initialize scenario
fProxy.setScenario(SCEN_SCENARIO4_TEST);
-
+
// ------------------------------------------------------------------------
// Enable default channel on created session above
// ------------------------------------------------------------------------
TraceControlDialogFactory.getInstance().setEnableChannelDialog(channelStub);
fFacility.executeCommand(session, "enableChannelOnSession");
-
+
// Verify that Kernel domain was created
ITraceControlComponent[] domains = session.getChildren();
assertNotNull(domains);
assertEquals(1, domains.length);
assertEquals("UST global", domains[0].getName());
-
+
// Verify that channel was created with correct data
ITraceControlComponent[] channels = domains[0].getChildren();
assertNotNull(channels);
assertEquals(1, channels.length);
assertTrue(channels[0] instanceof TraceChannelComponent);
- TraceChannelComponent channel = (TraceChannelComponent) channels[0];
+ TraceChannelComponent channel = (TraceChannelComponent) channels[0];
assertEquals("mychannel", channel.getName());
assertEquals(4, channel.getNumberOfSubBuffers());
assertEquals("mmap()", channel.getOutputType());
info.setSwitchTimer(100);
info.setReadTimer(200);
channelStub.setChannelInfo(info);
-
+
fFacility.executeCommand(domains[0], "enableChannelOnDomain");
// Get Kernel domain component instance
assertEquals(2, channels.length);
assertTrue(channels[1] instanceof TraceChannelComponent);
- channel = (TraceChannelComponent) channels[1];
+ channel = (TraceChannelComponent) channels[1];
assertEquals("mychannel2", channel.getName());
assertEquals(2, channel.getNumberOfSubBuffers());
assertEquals("mmap()", channel.getOutputType());
eventsDialogStub.setNames(events);
eventsDialogStub.setIsKernel(false);
TraceControlDialogFactory.getInstance().setEnableEventsDialog(eventsDialogStub);
-
+
fFacility.executeCommand(session, "enableEventOnSession");
-
+
// Get Kernel domain component instance
domains = session.getChildren();
assertNotNull(domains);
assertEquals(3, channels.length);
assertTrue(channels[2] instanceof TraceChannelComponent);
- channel = (TraceChannelComponent) channels[2];
+ channel = (TraceChannelComponent) channels[2];
assertEquals("channel0", channel.getName());
// No need to check parameters of default channel because that has been done in other tests
ITraceControlComponent[] channel0Events = channel.getChildren();
assertEquals(1, channel0Events.length);
-
+
assertTrue(channel0Events[0] instanceof TraceEventComponent);
TraceEventComponent event = (TraceEventComponent) channel0Events[0];
events.clear();
events.add("ust_tests_hello:tptest");
eventsDialogStub.setNames(events);
-
+
fFacility.executeCommand(domains[0], "enableEventOnDomain");
-
+
// Get Kernel domain component instance
domains = session.getChildren();
assertNotNull(domains);
// Verify that channel was created with correct data
channels = domains[0].getChildren();
- channel = (TraceChannelComponent) channels[2];
+ channel = (TraceChannelComponent) channels[2];
// No need to check parameters of default channel because that has been done in other tests
channel0Events = channel.getChildren();
assertEquals(2, channel0Events.length);
-
+
assertTrue(channel0Events[1] instanceof TraceEventComponent);
event = (TraceEventComponent) channel0Events[1];
// Verify that channel was created with correct data
channels = domains[0].getChildren();
- channel = (TraceChannelComponent) channels[1];
+ channel = (TraceChannelComponent) channels[1];
// No need to check parameters of default channel because that has been done in other tests
channel = (TraceChannelComponent) channels[1];
-
+
channel0Events = channel.getChildren();
assertEquals(1, channel0Events.length);
-
+
assertTrue(channel0Events[0] instanceof TraceEventComponent);
event = (TraceEventComponent) channel0Events[0];
// Enable event (wildcard) on specific channel
// ------------------------------------------------------------------------
events.clear();
- eventsDialogStub.setIsTracePoints(false);
+ eventsDialogStub.setIsTracePoints(false);
eventsDialogStub.setIsAllTracePoints(false);
eventsDialogStub.setIsWildcard(true);
eventsDialogStub.setWildcard("ust*");
// Verify that channel was created with correct data
channels = domains[0].getChildren();
- channel = (TraceChannelComponent) channels[0];
+ channel = (TraceChannelComponent) channels[0];
// No need to check parameters of default channel because that has been done in other tests
channel0Events = channel.getChildren();
assertEquals(1, channel0Events.length);
-
+
assertTrue(channel0Events[0] instanceof TraceEventComponent);
-
+
event = (TraceEventComponent) channel0Events[0];
assertEquals("ust*", event.getName());
assertEquals(TraceLogLevel.LEVEL_UNKNOWN, event.getLogLevel());
// Enable event (wildcard) on domain
// ------------------------------------------------------------------------
events.clear();
- eventsDialogStub.setIsTracePoints(false);
+ eventsDialogStub.setIsTracePoints(false);
eventsDialogStub.setIsAllTracePoints(false);
eventsDialogStub.setIsWildcard(true);
eventsDialogStub.setWildcard("ust*");
// Verify that channel was created with correct data
channels = domains[0].getChildren();
- channel = (TraceChannelComponent) channels[0];
+ channel = (TraceChannelComponent) channels[0];
// No need to check parameters of default channel because that has been done in other tests
channel0Events = channel.getChildren();
assertEquals(1, channel0Events.length);
-
+
assertTrue(channel0Events[0] instanceof TraceEventComponent);
-
+
event = (TraceEventComponent) channel0Events[0];
assertEquals("ust*", event.getName());
assertEquals(TraceLogLevel.LEVEL_UNKNOWN, event.getLogLevel());
// Enable event (wildcard) on session
// ------------------------------------------------------------------------
events.clear();
- eventsDialogStub.setIsTracePoints(false);
+ eventsDialogStub.setIsTracePoints(false);
eventsDialogStub.setIsAllTracePoints(false);
eventsDialogStub.setIsWildcard(true);
eventsDialogStub.setWildcard("ust*");
// Verify that channel was created with correct data
channels = domains[0].getChildren();
- channel = (TraceChannelComponent) channels[2];
+ channel = (TraceChannelComponent) channels[2];
// No need to check parameters of default channel because that has been done in other tests
channel0Events = channel.getChildren();
assertEquals(4, channel0Events.length);
-
+
assertTrue(channel0Events[0] instanceof TraceEventComponent);
-
+
event = (TraceEventComponent) channel0Events[0];
assertEquals("u*", event.getName());
assertEquals(TraceLogLevel.LEVEL_UNKNOWN, event.getLogLevel());
eventsDialogStub.setLogLevelEventName("myevent1");
eventsDialogStub.setLogLevelType(LogLevelType.LOGLEVEL);
eventsDialogStub.setLogLevel(TraceLogLevel.TRACE_WARNING);
-
+
fFacility.executeCommand(domains[0], "enableEventOnDomain");
// Get Kernel domain component instance
// Verify that channel was created with correct data
channels = domains[0].getChildren();
- channel = (TraceChannelComponent) channels[2];
+ channel = (TraceChannelComponent) channels[2];
// No need to check parameters of default channel because that has been done in other tests
channel0Events = channel.getChildren();
assertEquals(5, channel0Events.length);
-
+
assertTrue(channel0Events[0] instanceof TraceEventComponent);
-
+
event = (TraceEventComponent) channel0Events[0];
assertEquals("myevent1", event.getName());
assertEquals(TraceLogLevel.TRACE_WARNING, event.getLogLevel());
eventsDialogStub.setLogLevelEventName("myevent2");
eventsDialogStub.setLogLevelType(LogLevelType.LOGLEVEL_ONLY);
eventsDialogStub.setLogLevel(TraceLogLevel.TRACE_DEBUG_FUNCTION);
-
+
fFacility.executeCommand(session, "enableEventOnSession");
-
+
// Get Kernel domain component instance
domains = session.getChildren();
assertNotNull(domains);
// Verify that channel was created with correct data
channels = domains[0].getChildren();
- channel = (TraceChannelComponent) channels[2];
+ channel = (TraceChannelComponent) channels[2];
// No need to check parameters of default channel because that has been done in other tests
channel0Events = channel.getChildren();
assertEquals(6, channel0Events.length);
-
+
assertTrue(channel0Events[0] instanceof TraceEventComponent);
-
+
event = (TraceEventComponent) channel0Events[0];
assertEquals("myevent2", event.getName());
assertEquals(TraceLogLevel.TRACE_DEBUG_FUNCTION, event.getLogLevel());
eventsDialogStub.setLogLevelEventName("myevent0");
eventsDialogStub.setLogLevelType(LogLevelType.LOGLEVEL_ONLY);
eventsDialogStub.setLogLevel(TraceLogLevel.TRACE_DEBUG_FUNCTION);
-
+
fFacility.executeCommand(channels[0], "enableEventOnChannel");
-
+
// Get Kernel domain component instance
domains = session.getChildren();
assertNotNull(domains);
// Verify that channel was created with correct data
channels = domains[0].getChildren();
- channel = (TraceChannelComponent) channels[0];
+ channel = (TraceChannelComponent) channels[0];
// No need to check parameters of default channel because that has been done in other tests
channel0Events = channel.getChildren();
assertEquals(2, channel0Events.length);
-
+
assertTrue(channel0Events[0] instanceof TraceEventComponent);
-
+
event = (TraceEventComponent) channel0Events[0];
assertEquals("myevent0", event.getName());
assertEquals(TraceLogLevel.TRACE_DEBUG_FUNCTION, event.getLogLevel());
assertEquals(TraceEventType.TRACEPOINT, event.getEventType());
assertEquals(TraceEnablement.ENABLED, event.getState());
-
+
// ------------------------------------------------------------------------
- // Destroy session
+ // Destroy session
// ------------------------------------------------------------------------
// Initialize session handling scenario
fProxy.setScenario(TraceControlTestFacility.SCEN_SCENARIO_SESSION_HANDLING);
fFacility.destroySession(session);
-
+
// Verify that no more session components exist
assertEquals(0, groups[1].getChildren().length);
//-------------------------------------------------------------------------
// Delete node
//-------------------------------------------------------------------------
-
+
fFacility.executeCommand(node, "delete");
assertEquals(0,fFacility.getControlView().getTraceControlRoot().getChildren().length);
/*******************************************************************************
* Copyright (c) 2011 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
*******************************************************************************/
import junit.framework.Test;
import junit.framework.TestSuite;
+@SuppressWarnings("javadoc")
public class AllTests {
public static Test suite() {
/**********************************************************************
* 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.lttng2.ui.tests.control.service;
/**
* The class <code>LTTngControlServiceTest</code> contains test for the class <code>{@link LTTngControlService}</code>.
*/
-@SuppressWarnings("nls")
+@SuppressWarnings({"nls", "javadoc"})
public class LTTngControlServiceTest extends TestCase {
private static final String DIRECTORY = "testfiles";
private static final String TEST_STREAM = "LTTngServiceTest.cfg";
-
+
private static final String SCEN_LTTNG_NOT_INSTALLED = "LttngNotInstalled";
private static final String SCEN_LTTNG_VERSION = "LttngVersion";
private static final String SCEN_LTTNG_UNSUPPORTED_VERSION = "LttngUnsupportedVersion";
private LTTngToolsFileShell fShell;
private ILttngControlService fService;
-
+
// ------------------------------------------------------------------------
// Static methods
// ------------------------------------------------------------------------
URL location = FileLocator.find(FrameworkUtil.getBundle(this.getClass()), new Path(DIRECTORY + File.separator + TEST_STREAM), null);
File testfile = new File(FileLocator.toFileURL(location).toURI());
fTestfile = testfile.getAbsolutePath();
-
+
fShell = fShellFactory.getFileShell();
fShell.loadScenarioFile(fTestfile);
fService = new LTTngControlService(fShell);
// ------------------------------------------------------------------------
// Test Cases
// ------------------------------------------------------------------------
-
+
public void testVersion() {
try {
fShell.setScenario(SCEN_LTTNG_VERSION);
- ILttngControlService service = LTTngControlServiceFactory.getInstance().getLttngControlService(fShell);
+ ILttngControlService service = LTTngControlServiceFactory.getInstance().getLttngControlService(fShell);
assertNotNull(service);
assertEquals("2.0.0", service.getVersion());
} catch (ExecutionException e) {
fail("Exeption thrown " + e);
}
}
-
+
public void testUnsupportedVersion() {
try {
fShell.setScenario(SCEN_LTTNG_UNSUPPORTED_VERSION);
- LTTngControlServiceFactory.getInstance().getLttngControlService(fShell);
+ LTTngControlServiceFactory.getInstance().getLttngControlService(fShell);
fail("No exeption thrown");
} catch (ExecutionException e) {
// success
public void testNoVersion() {
try {
fShell.setScenario(SCEN_LTTNG_NO_VERSION);
- LTTngControlServiceFactory.getInstance().getLttngControlService(fShell);
+ LTTngControlServiceFactory.getInstance().getLttngControlService(fShell);
fail("No exeption thrown");
} catch (ExecutionException e) {
// success
// success
}
}
-
+
public void testGetSessionNames1() {
try {
fShell.setScenario(SCEN_NO_SESSION_AVAILABLE);
assertNotNull(result);
assertEquals(0, result.length);
-
+
} catch (ExecutionException e) {
fail(e.toString());
}
assertEquals(2, result.length);
assertEquals("mysession1", result[0]);
assertEquals("mysession", result[1]);
-
+
} catch (ExecutionException e) {
fail(e.toString());
}
fShell.setScenario(SCEN_GET_SESSION_NAME_NOT_EXIST);
fService.getSessionNames(new NullProgressMonitor());
fail("No exeption thrown");
-
+
} catch (ExecutionException e) {
// success
}
}
-
+
public void testGetSessionNameGarbage() {
try {
fShell.setScenario(SCEN_GET_SESSION_GARBAGE_OUT);
assertNotNull(result);
assertEquals(0, result.length);
-
+
} catch (ExecutionException e) {
fail(e.toString());
}
}
-
+
public void testGetSession1() {
try {
fShell.setScenario(SCEN_GET_SESSION1);
assertEquals("mysession", session.getName());
assertEquals("/home/user/lttng-traces/mysession-20120129-084256", session.getSessionPath());
assertEquals(TraceSessionState.ACTIVE, session.getSessionState());
-
+
IDomainInfo[] domains = session.getDomains();
assertNotNull(domains);
assertEquals(2, domains.length);
-
+
// Verify Kernel domain
assertEquals("Kernel", domains[0].getName());
IChannelInfo[] channels = domains[0].getChannels();
assertNotNull(channels);
assertEquals(2, channels.length);
- // Verify Kernel's channel0
+ // Verify Kernel's channel0
assertEquals("channel0", channels[0].getName());
assertEquals(4, channels[0].getNumberOfSubBuffers());
assertEquals("splice()", channels[0].getOutputType());
assertEquals(TraceEnablement.ENABLED, channels[0].getState());
assertEquals(262144, channels[0].getSubBufferSize());
assertEquals(0, channels[0].getSwitchTimer());
-
+
// Verify event info
IEventInfo[] channel0Events = channels[0].getEvents();
assertNotNull(channel0Events);
assertEquals(TraceLogLevel.TRACE_EMERG, channel0Events[0].getLogLevel());
assertEquals(TraceEventType.TRACEPOINT, channel0Events[0].getEventType());
assertEquals(TraceEnablement.ENABLED, channel0Events[0].getState());
-
+
assertEquals("block_bio_remap", channel0Events[1].getName());
assertEquals(TraceLogLevel.TRACE_EMERG, channel0Events[1].getLogLevel());
assertEquals(TraceEventType.TRACEPOINT, channel0Events[1].getEventType());
assertEquals(TraceEnablement.DISABLED, channel0Events[1].getState());
-
- // Verify Kernel's channel1
+
+ // Verify Kernel's channel1
assertEquals("channel1", channels[1].getName());
assertEquals(4, channels[1].getNumberOfSubBuffers());
assertEquals("splice()", channels[1].getOutputType());
assertEquals(TraceEnablement.DISABLED, channels[1].getState());
assertEquals(524288, channels[1].getSubBufferSize());
assertEquals(100, channels[1].getSwitchTimer());
-
+
// Verify event info
IEventInfo[] channel1Events = channels[1].getEvents();
assertEquals(0, channel1Events.length);
-
+
// Verify domain UST global
assertEquals("UST global", domains[1].getName());
-
+
IChannelInfo[] ustChannels = domains[1].getChannels();
-
- // Verify UST global's mychannel1
+
+ // Verify UST global's mychannel1
assertEquals("mychannel1", ustChannels[0].getName());
assertEquals(8, ustChannels[0].getNumberOfSubBuffers());
assertEquals("mmap()", ustChannels[0].getOutputType());
assertEquals(TraceEnablement.DISABLED, ustChannels[0].getState());
assertEquals(8192, ustChannels[0].getSubBufferSize());
assertEquals(200, ustChannels[0].getSwitchTimer());
-
+
// Verify event info
IEventInfo[] ustEvents = ustChannels[0].getEvents();
assertEquals(0, ustEvents.length);
- // Verify UST global's channel0
+ // Verify UST global's channel0
assertEquals("channel0", ustChannels[1].getName());
assertEquals(4, ustChannels[1].getNumberOfSubBuffers());
assertEquals("mmap()", ustChannels[1].getOutputType());
assertEquals(TraceEnablement.ENABLED, ustChannels[1].getState());
assertEquals(4096, ustChannels[1].getSubBufferSize());
assertEquals(0, ustChannels[1].getSwitchTimer());
-
+
// Verify event info
ustEvents = ustChannels[1].getEvents();
assertEquals(2, ustEvents.length);
-
+
assertEquals("ust_tests_hello:tptest_sighandler", ustEvents[0].getName());
assertEquals(TraceLogLevel.TRACE_DEBUG_LINE, ustEvents[0].getLogLevel());
assertEquals(TraceEventType.TRACEPOINT, ustEvents[0].getEventType());
assertEquals(TraceEnablement.DISABLED, ustEvents[0].getState());
-
+
assertEquals("*", ustEvents[1].getName());
assertEquals(TraceLogLevel.LEVEL_UNKNOWN, ustEvents[1].getLogLevel());
assertEquals(TraceEventType.TRACEPOINT, ustEvents[1].getEventType());
assertEquals(TraceEnablement.ENABLED, ustEvents[1].getState());
-
+
// next session (no detailed information available)
session = fService.getSession("mysession1", new NullProgressMonitor());
assertNotNull(session);
assertEquals("mysession1", session.getName());
assertEquals("/home/user/lttng-traces/mysession1-20120203-133225", session.getSessionPath());
assertEquals(TraceSessionState.INACTIVE, session.getSessionState());
-
+
domains = session.getDomains();
assertNotNull(domains);
assertEquals(0, domains.length);
// Verify event info
assertNotNull(events);
assertEquals(3, events.size());
-
- IBaseEventInfo baseEventInfo = (IBaseEventInfo) events.get(0);
+
+ IBaseEventInfo baseEventInfo = events.get(0);
assertNotNull(baseEventInfo);
assertEquals("sched_kthread_stop", baseEventInfo.getName());
assertEquals(TraceLogLevel.TRACE_EMERG, baseEventInfo.getLogLevel());
assertEquals(TraceEventType.TRACEPOINT, baseEventInfo.getEventType());
-
- baseEventInfo = (IBaseEventInfo) events.get(1);
+
+ baseEventInfo = events.get(1);
assertEquals("sched_kthread_stop_ret", baseEventInfo.getName());
assertEquals(TraceLogLevel.TRACE_EMERG, baseEventInfo.getLogLevel());
assertEquals(TraceEventType.TRACEPOINT, baseEventInfo.getEventType());
-
- baseEventInfo = (IBaseEventInfo) events.get(2);
+
+ baseEventInfo = events.get(2);
assertEquals("sched_wakeup_new", baseEventInfo.getName());
assertEquals(TraceLogLevel.TRACE_EMERG, baseEventInfo.getLogLevel());
assertEquals(TraceEventType.TRACEPOINT, baseEventInfo.getEventType());
// Check all providers
assertNotNull(providers);
assertEquals(2, providers.size());
-
+
//Verify first provider
assertEquals("/home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello", providers.get(0).getName());
assertEquals(9379, providers.get(0).getPid());
-
+
// Verify event info
IBaseEventInfo[] events = providers.get(0).getEvents();
assertNotNull(events);
assertEquals(2, events.length);
- IBaseEventInfo baseEventInfo = (IBaseEventInfo) events[0];
+ IBaseEventInfo baseEventInfo = events[0];
assertNotNull(baseEventInfo);
assertEquals("ust_tests_hello:tptest_sighandler", baseEventInfo.getName());
assertEquals(TraceLogLevel.TRACE_DEBUG_MODULE, baseEventInfo.getLogLevel());
assertEquals(TraceEventType.TRACEPOINT, baseEventInfo.getEventType());
-
- baseEventInfo = (IBaseEventInfo) events[1];
+
+ baseEventInfo = events[1];
assertEquals("ust_tests_hello:tptest", baseEventInfo.getName());
assertEquals(TraceLogLevel.TRACE_INFO, baseEventInfo.getLogLevel());
assertEquals(TraceEventType.TRACEPOINT, baseEventInfo.getEventType());
//Verify second provider
assertEquals("/home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello", providers.get(1).getName());
assertEquals(4852, providers.get(1).getPid());
-
+
// Verify event info
events = providers.get(1).getEvents();
assertNotNull(events);
assertEquals(2, events.length);
- baseEventInfo = (IBaseEventInfo) events[0];
+ baseEventInfo = events[0];
assertNotNull(baseEventInfo);
assertEquals("ust_tests_hello:tptest_sighandler", baseEventInfo.getName());
assertEquals(TraceLogLevel.TRACE_WARNING, baseEventInfo.getLogLevel());
assertEquals(TraceEventType.TRACEPOINT, baseEventInfo.getEventType());
-
- baseEventInfo = (IBaseEventInfo) events[1];
+
+ baseEventInfo = events[1];
assertEquals("ust_tests_hello:tptest", baseEventInfo.getName());
assertEquals(TraceLogLevel.TRACE_DEBUG_FUNCTION, baseEventInfo.getLogLevel());
assertEquals(TraceEventType.TRACEPOINT, baseEventInfo.getEventType());
assertNotNull(providers);
assertEquals(0, providers.size());
-
+
} catch (ExecutionException e) {
fail(e.toString());
}
} catch (ExecutionException e) {
// success
}
-
+
try {
fService.createSession("wrongName", null, new NullProgressMonitor());
fail("No exeption thrown");
} catch (ExecutionException e) {
// success
- }
+ }
try {
fService.createSession("withPath", "/home/user/hallo", new NullProgressMonitor());
fail("No exeption thrown");
} catch (ExecutionException e) {
// success
- }
+ }
try {
ISessionInfo info = fService.createSession("session with spaces", null, new NullProgressMonitor());
assertNotNull(info.getSessionPath());
assertTrue(info.getSessionPath().contains("session with spaces"));
assertEquals(TraceSessionState.INACTIVE, info.getSessionState());
-
+
} catch (ExecutionException e) {
fail(e.toString());
- }
+ }
try {
ISessionInfo info = fService.createSession("pathWithSpaces", "/home/user/hallo user/here", new NullProgressMonitor());
assertNotNull(info.getSessionPath());
assertTrue(info.getSessionPath().contains("/home/user/hallo user/here"));
assertEquals(TraceSessionState.INACTIVE, info.getSessionState());
-
+
} catch (ExecutionException e) {
fail(e.toString());
- }
+ }
}
public void testDestroySession() {
fService.destroySession("mysession2", new NullProgressMonitor());
} catch (ExecutionException e) {
fail(e.toString());
- }
+ }
}
public void testCreateChannel() {
String kernelChannel1 = "mychannel1";
list.add(kernelChannel0);
list.add(kernelChannel1);
-
+
fShell.setScenario(SCEN_CHANNEL_HANDLING);
-
+
// Create/enable/configure 2 kernel channels
ChannelInfo chanInfo = new ChannelInfo("");
chanInfo.setOverwriteMode(true);
chanInfo.setSwitchTimer(200);
chanInfo.setNumberOfSubBuffers(2);
fService.enableChannels(sessionName, list, true, chanInfo, new NullProgressMonitor());
-
+
// Create/enable/configure 1 UST channel
list.clear();
list.add("ustChannel");
-
+
chanInfo = new ChannelInfo("");
chanInfo.setOverwriteMode(true);
chanInfo.setSubBufferSize(32768);
String kernelChannel1 = "mychannel1";
list.add(kernelChannel0);
list.add(kernelChannel1);
-
+
fShell.setScenario(SCEN_CHANNEL_HANDLING);
fService.disableChannels(sessionName, list, true, new NullProgressMonitor());
-
+
list.clear();
list.add("ustChannel");
fService.disableChannels(sessionName, list, false, new NullProgressMonitor());
fail(e.toString());
}
}
-
+
public void testEnableChannel() {
try {
String kernelChannel1 = "mychannel1";
list.add(kernelChannel0);
list.add(kernelChannel1);
-
+
fShell.setScenario(SCEN_CHANNEL_HANDLING);
fService.enableChannels(sessionName, list, true, null, new NullProgressMonitor());
-
+
// Create/enable/configure 1 UST channel
list.clear();
list.add("ustChannel");
-
+
fService.enableChannels(sessionName, list, false, null, new NullProgressMonitor());
} catch (ExecutionException e) {
fail(e.toString());
}
}
-
+
// public void tesEnableChannelNoTracer() {
// try {
// ILttngControlService service = new LTTngControlService(fShellFactory.getShellForChannelNoTracer());
// service.getSessionNames(new NullProgressMonitor());
// fail("No exeption thrown");
-//
+//
// } catch (ExecutionException e) {
// // success
// }
-// }
-
+// }
+
public void testEnableEvents() {
try {
// 1) session name, channel = null, 3 event names, kernel
list.add(eventName2);
fShell.setScenario(SCEN_EVENT_HANDLING);
fService.enableEvents(sessionName, null, list, true, new NullProgressMonitor());
-
+
// 2) session name, channel=mychannel, event name= null, kernel
String channelName = "mychannel";
fService.enableEvents(sessionName, channelName, null, true, new NullProgressMonitor());
list.clear();
list.add(ustEventName);
fService.enableEvents(sessionName, channelName, list, false, new NullProgressMonitor());
-
+
// 4) session name, channel = mychannel, no event name, ust
list.clear();
fService.enableEvents(sessionName, channelName, list, false, new NullProgressMonitor());
-
+
} catch (ExecutionException e) {
fail(e.toString());
}
}
-
+
public void testEnableSyscalls() {
try {
// 1) session name, channel = null, 3 event names, kernel
String sessionName = "mysession2";
String channelName = "mychannel";
-
+
fShell.setScenario(SCEN_EVENT_HANDLING);
- // 1) session name, channel = null
+ // 1) session name, channel = null
fService.enableSyscalls(sessionName, null, new NullProgressMonitor());
// 2) session name, channel = mychannel
fService.enableSyscalls(sessionName, channelName, new NullProgressMonitor());
-
+
} catch (ExecutionException e) {
fail(e.toString());
}
String eventName1 = "myevent1";
String functionProbe = "0xc0101340";
String dynProbe = "init_post";
-
+
fShell.setScenario(SCEN_EVENT_HANDLING);
- // 1) session name, channel = null, event name, function probe, probe
+ // 1) session name, channel = null, event name, function probe, probe
fService.enableProbe(sessionName, null, eventName0, true, functionProbe, new NullProgressMonitor());
// 2) session name, channel = mychannel
fService.enableProbe(sessionName, channelName, eventName1, false, dynProbe, new NullProgressMonitor());
-
+
} catch (ExecutionException e) {
fail(e.toString());
}
String channelName = "mychannel";
String eventName4 = "myevent4";
String eventName5 = "myevent5";
-
+
fShell.setScenario(SCEN_EVENT_HANDLING);
-
+
// 1) session name, channel = null, event name, loglevel-only, TRACE_DEBUG
fService.enableLogLevel(sessionName, null, eventName4, LogLevelType.LOGLEVEL_ONLY, TraceLogLevel.TRACE_DEBUG, new NullProgressMonitor());
fail(e.toString());
}
}
-
+
public void testAddContext() {
try {
// 1) session name, channel = null, 3 event names, kernel
assertNotNull(availContexts);
assertEquals(12, availContexts.size());
- // A very "hard-coded" way to verify but it works ...
+ // A very "hard-coded" way to verify but it works ...
Set<String> expectedContexts = new HashSet<String>();
expectedContexts.add("pid");
expectedContexts.add("procname");
expectedContexts.add("vppid");
expectedContexts.add("perf:cpu-cycles");
expectedContexts.add("perf:cycles");
-
+
assertTrue(expectedContexts.containsAll(availContexts));
-
+
// 1) session name, channel = null, event name, loglevel-only, TRACE_DEBUG
fService.addContexts(sessionName, channelName, eventName, false, contexts, new NullProgressMonitor());
fail("No exeption generated");
} catch (ExecutionException e) {
// success
- }
+ }
try {
// 1) session name, channel = null, event name, loglevel-only, TRACE_DEBUG
fService.addContexts(sessionName, channelName, eventName, false, contexts, new NullProgressMonitor());
fail("No exeption generated");
} catch (ExecutionException e) {
// success
- }
+ }
}
public void testCalibrate() {
fail("No exeption generated");
} catch (ExecutionException e) {
// success
- }
+ }
}
-
+
}
/**********************************************************************
* 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.stubs.dialogs;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IAddContextDialog;
/**
- * Add Context dialog stub.
+ * Add Context dialog stub.
*/
+@SuppressWarnings("javadoc")
public class AddContextDialogStub implements IAddContextDialog {
private Set<String> fAvailableContexts = null;
public void setContexts(List<String> contexts) throws IllegalArgumentException{
fContexts = new ArrayList<String>();
fContexts.addAll(contexts);
- // If availableContexts are null we cannot verify
+ // If availableContexts are null we cannot verify
if (fAvailableContexts != null) {
for (Iterator<String> iterator = fContexts.iterator(); iterator.hasNext();) {
- String string = (String) iterator.next();
+ String string = iterator.next();
if (!fAvailableContexts.contains(string)) {
throw new IllegalArgumentException();
}
/**********************************************************************
* 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.stubs.dialogs;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceSessionGroup;
/**
- * Create session dialog stub implementation.
+ * Create session dialog stub implementation.
*/
+@SuppressWarnings("javadoc")
public class CreateSessionDialogStub implements ICreateSessionDialog {
-
+
public String fName = "mysession"; //$NON-NLS-1$
public String fPath = null;
-
-
+
+
@Override
public String getSessionName() {
return fName;
public int open() {
return 0;
}
-
+
public void setSessionPath(String path) {
fPath = path;
}
-
+
public void setSessionName(String name) {
fName = name;
}
/**********************************************************************
* 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.stubs.dialogs;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceDomainComponent;
/**
- * Create channel dialog stub implementation.
+ * Create channel dialog stub implementation.
*/
+@SuppressWarnings("javadoc")
public class EnableChannelDialogStub implements IEnableChannelDialog {
-
+
// ------------------------------------------------------------------------
// Attributes
// ------------------------------------------------------------------------
private TraceDomainComponent fDomain;
private ChannelInfo fChannelInfo;
private boolean fIsKernel;
-
+
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
fChannelInfo.setSwitchTimer(100);
fChannelInfo.setSubBufferSize(16384);
}
-
+
// ------------------------------------------------------------------------
// Accessors
// ------------------------------------------------------------------------
public void setIsKernel(boolean isKernel) {
fIsKernel = isKernel;
}
-
+
@Override
public IChannelInfo getChannelInfo() {
return fChannelInfo;
public boolean isKernel() {
return fIsKernel;
}
-
+
public void setChannelInfo(ChannelInfo info) {
fChannelInfo = info;
}
/**********************************************************************
* 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.stubs.dialogs;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceProviderGroup;
/**
- * Enable events dialog stub implementation.
+ * Enable events dialog stub implementation.
*/
+@SuppressWarnings("javadoc")
public class EnableEventsDialogStub implements IEnableEventsDialog {
// ------------------------------------------------------------------------
public void setLogLevelType(LogLevelType logLevelType) {
fLogLevelType = logLevelType;
}
-
+
public void setNames(List<String> names) {
fNames = names;
}
/**********************************************************************
* 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.stubs.service;
import org.eclipse.linuxtools.internal.lttng2.stubs.shells.LTTngToolsFileShell;
+@SuppressWarnings("javadoc")
public class CommandShellFactory {
public static final int GET_SESSION_NAMES_COMMAND_SHELL = 0;
-
+
private static CommandShellFactory fInstance = null;
-
+
public static CommandShellFactory getInstance() {
if (fInstance == null) {
fInstance = new CommandShellFactory();
// ICommandShell shell = new LTTngToolsSimulatorShell(proxy);
// return shell;
// }
-
+
public LTTngToolsFileShell getFileShell() {
return new LTTngToolsFileShell();
}
/**********************************************************************
* 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.stubs.service;
import org.eclipse.rse.services.terminals.ITerminalService;
import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSystem;
-
+@SuppressWarnings("javadoc")
public class TestRemoteSystemProxy implements IRemoteSystemProxy {
-
+
private LTTngToolsFileShell fShell = null;
private String fTestFile = null;
private String fScenario = null;
@Override
public ICommandShell createCommandShell() throws ExecutionException {
- if (fShell == null) {
+ if (fShell == null) {
fShell = CommandShellFactory.getInstance().getFileShell();
if ((fTestFile != null) && (fScenario != null)) {
try {
@Override
public void removeCommunicationListener(ICommunicationsListener listener) {
}
-
+
public void setTestFile(String testFile) {
fTestFile = testFile;
}
-
+
public void setScenario(String scenario) {
fScenario = scenario;
if (fShell != null) {
/**********************************************************************
* 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.stubs.shells;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.remote.CommandResult;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.remote.ICommandResult;
+@SuppressWarnings("javadoc")
public class LTTngToolsFileShell extends TestCommandShell {
// ------------------------------------------------------------------------
private final static String OUTPUT_KEY = "<COMMAND_OUTPUT>"; //$NON-NLS-1$
private final static String OUTPUT_END_KEY = "</COMMAND_OUTPUT>"; //$NON-NLS-1$
private final static String COMMENT_KEY = "#.*"; //$NON-NLS-1$
-
+
private final static Pattern LTTNG_LIST_SESSION_PATTERN = Pattern.compile("lttng\\s+list\\s+(.+)"); //$NON-NLS-1$
private final static String LTTNG_LIST_PROVIDER_PATTERN = "lttng\\s+list\\s+(-u|-k)"; //$NON-NLS-1$
private String fScenariofile;
private String fScenario;
- private Map<String, Map<String, ICommandResult>> fScenarioMap = new HashMap<String, Map<String, ICommandResult>>();
- private Map<String, Integer> fSessionNameMap = new HashMap<String, Integer>();
+ private final Map<String, Map<String, ICommandResult>> fScenarioMap = new HashMap<String, Map<String, ICommandResult>>();
+ private final Map<String, Integer> fSessionNameMap = new HashMap<String, Integer>();
/**
* Parse a scenario file with the format:
* <SCENARIO>
* ScenarioName
- *
+ *
* <COMMAND_INPUT>
* Command
* </COMAND_INPUT>
- *
+ *
* <COMMAND_RESULT>
* CommandResult
* </COMMAND_RESULT>
- *
+ *
* <COMMAND_OUTPUT>
* CommandOutput
* </COMMAND_OUTPUT>
- *
+ *
* </SCENARIO>
- *
+ *
* Where: ScenarioName - is the scenario name
* Command - the command line string
* CommandResult - the result integer of the command (0 for success, 1 for failure)
* ComandOutput - the command output string (multi-line possible)
- *
+ *
* Note: 1) There can be many scenarios per file
* 2) There can be many (Command-CommandResult-CommandOutput) triples per scenario
* 3) Lines starting with # will be ignored (comments)
- *
+ *
* @param scenariofile - path to scenario file
* @throws Exception
*/
public synchronized void loadScenarioFile(String scenariofile) throws Exception {
fScenariofile = scenariofile;
-
+
// clean up map
Collection<Map<String, ICommandResult>> values = fScenarioMap.values();
for (Iterator<Map<String, ICommandResult>> iterator = values.iterator(); iterator.hasNext();) {
- Map<String, ICommandResult> map = (Map<String, ICommandResult>) iterator.next();
+ Map<String, ICommandResult> map = iterator.next();
map.clear();
}
fScenarioMap.clear();
-
+
// load from file
-
+
// Open the file
FileInputStream fstream = new FileInputStream(fScenariofile);
-
+
// Get the object of DataInputStream
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String strLine;
-
+
// Read File Line by Line
-
- // Temporary map for generating instance numbers for lttng list <session> commands.
+
+ // Temporary map for generating instance numbers for lttng list <session> commands.
// The numbers are per scenario.
Map<String, Integer> tmpSessionNameMap = new HashMap<String, Integer>();
while ((strLine = br.readLine()) != null) {
int result = 0;
tmpSessionNameMap.clear();
while ((strLine = br.readLine()) != null) {
- // Ignore comments
+ // Ignore comments
if(isComment(strLine)) {
continue;
}
if (SCENARIO_END_KEY.equals(strLine)) {
// Scenario is finished
break;
- }
+ }
if (INPUT_KEY.equals(strLine)) {
strLine = br.readLine();
// Ignore comments
}
// Read command
input = strLine;
-
+
// Handle instances of 'lttng list <session"-comamand
Matcher matcher = LTTNG_LIST_SESSION_PATTERN.matcher(strLine);
if (matcher.matches() && !input.matches(LTTNG_LIST_PROVIDER_PATTERN)) {
} else if (inOutput) {
// subsequent lines of output
output.add(strLine);
- }
-// else {
+ }
+// else {
// if (RESULT_END_KEY.equals(strLine)) {
// nothing to do
// }
if (commands.containsKey(command)) {
return commands.get(command);
- }
+ }
String[] output = new String[1];
output[0] = String.valueOf("Command not found");
result.setResult(1);
return result;
}
-
+
// ------------------------------------------------------------------------
// Helper methods
// ------------------------------------------------------------------------
/**********************************************************************
* 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.stubs.shells;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.remote.ICommandResult;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.remote.ICommandShell;
+/**
+ * Command shell stub
+ */
public class TestCommandShell implements ICommandShell {
protected boolean fIsConnected = false;
-
+
@Override
public void connect() throws ExecutionException {
fIsConnected = true;
}
-
+
@Override
public void disconnect() {
fIsConnected = false;
@Override
public ICommandResult executeCommand(String command, IProgressMonitor monitor, boolean checkReturnValue) throws ExecutionException {
if (fIsConnected) {
-
+
}
return new CommandResult(0, new String[0]);
}
/*******************************************************************************
* Copyright (c) 2009, 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:
* Francois Chouinard - Initial API and implementation
* Bernd Hufmann - Filled with content
/**
* <p>
- * View implementation for Trace Control.
+ * View implementation for Trace Control.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class ControlView extends ViewPart implements ITraceControlComponentChangedListener {
* The tree viewer.
*/
private TreeViewer fTreeViewer = null;
-
+
/**
- * The trace control root node. This provides access to the whole model.
+ * The trace control root node. This provides access to the whole model.
*/
private ITraceControlComponent fRoot = null;
-
+
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
/**
* Returns the trace control tree node (model)
- *
+ *
* @return the trace control tree node (model).
*/
public ITraceControlComponent getTraceControlRoot() {
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
*/
@Override
// Create context menu for the tree viewer
createContextMenu();
-
+
getSite().setSelectionProvider(fTreeViewer);
-
+
RSECorePlugin.getTheSystemRegistry(); // to load RSE
}
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.ui.part.WorkbenchPart#setFocus()
*/
@Override
public void setFocus() {
fTreeViewer.getControl().setFocus();
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponentChangedListener#componentAdded(org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponent, org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponent)
fTreeViewer.refresh(component);
- // Change selection needed
+ // Change selection needed
final ISelection sel = fTreeViewer.getSelection();
fTreeViewer.setSelection(null);
fTreeViewer.setSelection(sel);
myJob.setUser(false);
myJob.schedule();
}
-
+
/**
* Sets the selected component in the tree
* @param component - component to select
/**
* Sets the selected components in the tree
- * @param component - array of components to select
+ * @param components - array of components to select
*/
public void setSelection(ITraceControlComponent[] components) {
final StructuredSelection selection = new StructuredSelection(components);
myJob.setUser(false);
myJob.schedule();
}
-
+
// ------------------------------------------------------------------------
// Helper methods
// ------------------------------------------------------------------------
/**********************************************************************
* 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;
* <p>
* Dialog box for collecting information about contexts to be added to channels/events.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class AddContextDialog extends Dialog implements IAddContextDialog {
// ------------------------------------------------------------------------
// Constants
// ------------------------------------------------------------------------
-
+
/**
* The icon file for this dialog box.
*/
- public static final String ADD_CONTEXT_ICON_FILE = "icons/elcl16/add-context.gif"; //$NON-NLS-1$
+ public static final String ADD_CONTEXT_ICON_FILE = "icons/elcl16/add-context.gif"; //$NON-NLS-1$
// ------------------------------------------------------------------------
// Attributes
/**
* A Tree model for the checkbox tree viewer.
*/
- private ContextModel fContextModel = new ContextModel();
+ private final ContextModel fContextModel = new ContextModel();
/**
* The contexts to add.
*/
- private List<String> fSelectedContexts = new ArrayList<String>();
-
+ private final List<String> fSelectedContexts = new ArrayList<String>();
+
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
super(shell);
setShellStyle(SWT.RESIZE);
}
-
+
// ------------------------------------------------------------------------
// Accessors
// ------------------------------------------------------------------------
-
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IAddContextDialog#setAvalibleContexts(java.util.List)
public void setAvalibleContexts(List<String> contexts) {
fContextModel.setAvalibleContexts(contexts);
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IAddContextDialog#getContexts()
layout = new GridLayout(1, true);
contextGroup.setLayout(layout);
contextGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
-
+
fContextsViewer = new CheckboxTreeViewer(contextGroup, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
- fContextsViewer.getTree().setToolTipText(Messages.TraceControl_AddContextAvailableContextsTooltip);
+ fContextsViewer.getTree().setToolTipText(Messages.TraceControl_AddContextAvailableContextsTooltip);
fContextsViewer.setContentProvider(new ContextsContentProvider());
fContextsViewer.setLabelProvider(new ContextsLabelProvider());
fContextsViewer.addCheckStateListener(new ContextCheckListener());
fContextsViewer.setInput(fContextModel);
fContextsViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
-
+
getShell().setMinimumSize(new Point(500, 450));
-
+
return fDialogComposite;
}
fSelectedContexts.add(component.getName());
}
}
-
+
// validation successful -> call super.okPressed()
super.okPressed();
}
-
+
// ------------------------------------------------------------------------
// Helper classes and methods
// ------------------------------------------------------------------------
final public static class ContextsLabelProvider extends ColumnLabelProvider {
@Override
public String getText(Object element) {
-
+
if ((element != null) && (element instanceof IContextModelComponent)) {
return ((IContextModelComponent)element).getName();
}
return "";//$NON-NLS-1$
}
}
-
+
/**
- * Check state listener for the contexts tree.
+ * Check state listener for the contexts tree.
*/
final public class ContextCheckListener implements ICheckStateListener {
@Override
if (event.getChecked()) {
if (event.getElement() instanceof AllContexts) {
fContextsViewer.setSubtreeChecked(event.getElement(), true);
- }
- } else {
+ }
+ } else {
if (event.getElement() instanceof AllContexts) {
fContextsViewer.setSubtreeChecked(event.getElement(), false);
} else {
*/
public static class ContextModel implements IContextModelComponent {
- private AllContexts fAllContexts;
-
+ private final AllContexts fAllContexts;
+
+ /**
+ * Constructor
+ */
public ContextModel() {
fAllContexts = new AllContexts(this);
}
+ /**
+ * Sets the available contexts
+ *
+ * @param contexts
+ * The contexts to set
+ */
public void setAvalibleContexts(List<String> contexts) {
fAllContexts.setAvalibleContexts(contexts);
}
-
+
@Override
public String getName() {
return "root"; //$NON-NLS-1$
}
-
+
@Override
public Object getParent() {
return null;
}
/**
- * Model element (to select/deselect) all contexts) for the context tree viewer
+ * Model element (to select/deselect) all contexts) for the context tree viewer
*/
public static class AllContexts implements IContextModelComponent {
/**
* The available list of contexts.
*/
private List<Context> fAvailableContexts;
-
- private IContextModelComponent fParent;
+ private final IContextModelComponent fParent;
+
+ /**
+ * Constructor
+ *
+ * @param parent
+ * The parent component
+ */
public AllContexts(IContextModelComponent parent) {
fParent = parent;
}
-
+
+ /**
+ * Sets the available contexts
+ *
+ * @param contexts
+ * The contexts to set
+ */
public void setAvalibleContexts(List<String> contexts) {
fAvailableContexts = new ArrayList<Context>();
if (contexts != null) {
for (Iterator<String> iterator = contexts.iterator(); iterator.hasNext();) {
- String name = (String) iterator.next();
+ String name = iterator.next();
fAvailableContexts.add(new Context(this, name));
}
}
public String getName() {
return Messages.TraceControl_AddContextAllLabel;
}
-
+
@Override
public Object[] getChildren() {
return fAvailableContexts.toArray();
}
-
+
@Override
public Object getParent() {
return fParent;
}
-
+
@Override
public boolean hasChildren() {
return true;
}
/**
- * Model element (the context) for the context tree viewer
+ * Model element (the context) for the context tree viewer
*/
public static class Context implements IContextModelComponent {
- private String fContextName;
- private IContextModelComponent fParent;
-
+ private final String fContextName;
+ private final IContextModelComponent fParent;
+
+ /**
+ * Constructor
+ *
+ * @param parent
+ * The parent component
+ * @param name
+ * The name of this context
+ */
public Context(IContextModelComponent parent, String name) {
fParent = parent;
fContextName = name;
}
-
+
@Override
public String getName() {
return fContextName;
}
/**
- * Interface for the tree model used for the context tree viewer.
+ * Interface for the tree model used for the context tree viewer.
*/
public interface IContextModelComponent {
+
+ /**
+ * @return The name of this component
+ */
public String getName();
+
+ /**
+ * @return The parent component
+ */
public Object getParent();
+
+ /**
+ * @return The array of children of this component
+ */
public Object[] getChildren();
+
+ /**
+ * @return If this component has children or not
+ */
public boolean hasChildren();
}
}
/**********************************************************************
* 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;
* <p>
* Dialog box for collecting information events to be enabled.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class EnableEventsDialog extends Dialog implements IEnableEventsDialog {
// ------------------------------------------------------------------------
// Constants
// ------------------------------------------------------------------------
-
+
/**
* The icon file for this dialog box.
*/
- public static final String ENABLE_EVENT_ICON_FILE = "icons/elcl16/enable_event.gif"; //$NON-NLS-1$
+ public static final String ENABLE_EVENT_ICON_FILE = "icons/elcl16/enable_event.gif"; //$NON-NLS-1$
// ------------------------------------------------------------------------
// Attributes
*/
private EnableKernelEventComposite fKernelComposite;
/**
- * The composite with widgets for collecting information about UST events.
+ * The composite with widgets for collecting information about UST events.
*/
private EnableUstEventsComposite fUstComposite;
/**
*/
private Button fUstButton;
/**
- * The referenced trace provider group containing the kernel provider and UST
+ * The referenced trace provider group containing the kernel provider and UST
* provider component which contains a list of available tracepoints.
*/
private TraceProviderGroup fProviderGroup;
/**
- * The parent domain component where the channel node should be added.
+ * The parent domain component where the channel node should be added.
* Null in case the domain is not known (i.e. on session level).
*/
private TraceDomainComponent fDomain;
/**
- * Output domain information. True in case of Kernel domain. False for UST.
+ * Output domain information. True in case of Kernel domain. False for UST.
*/
private boolean fIsKernel;
/**
* Constructor
* @param shell - a shell for the display of the dialog
- * @param providerGroup - the trace provider group
*/
public EnableEventsDialog(Shell shell) {
super(shell);
setShellStyle(SWT.RESIZE);
}
-
+
// ------------------------------------------------------------------------
// Accessors
// ------------------------------------------------------------------------
-
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#isTracpoints()
}
return fUstComposite.isTracepoints();
}
-
+
/* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#isAllTracePoints()
*/
}
return fUstComposite.isAllTracePoints();
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#isSysCalls()
}
return false;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#isAllSysCalls()
*/
}
return false;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#getEventNames()
*/
}
return false;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#getProbeName()
*/
}
return null;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#getProbeEventName()
*/
}
return null;
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#isDynamicFunctionProbe()
}
return false;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#getFunctionEventName()
*/
}
return null;
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#getFunction()
}
return null;
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableUstEvents#isWildcard()
return fUstComposite.getWildcard();
}
return null;
-
+
}
/*
return fUstComposite.isLogLevel();
}
return false;
-
+
}
/*
return fUstComposite.getLogLevelType();
}
return null;
-
+
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableUstEvents#getLogLevel()
return fUstComposite.getLogLevel();
}
return null;
-
+
}
/*
}
return null;
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableEventsDialog#isKernel()
public boolean isKernel() {
return fIsKernel;
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableEventsDialog#setTraceProviderGroup(org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceProviderGroup)
*/
@Override
protected Control createDialogArea(Composite parent) {
-
+
// Main dialog panel
fDialogComposite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout(1, true);
fDialogComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
// ------------------------------------------------------------------------
- // Domain Group
+ // Domain Group
// ------------------------------------------------------------------------
Group domainGroup = new Group(fDialogComposite, SWT.SHADOW_NONE);
domainGroup.setText(Messages.TraceControl_DomainDisplayName);
layout = new GridLayout(2, true);
- domainGroup.setLayout(layout);
-
+ domainGroup.setLayout(layout);
+
fKernelButton = new Button(domainGroup, SWT.RADIO);
fKernelButton.setText(Messages.TraceControl_KernelDomainDisplayName);
fKernelButton.setSelection(fIsKernel);
fUstButton.setLayoutData(data);
// ------------------------------------------------------------------------
- // Kernel or UST event data group
+ // Kernel or UST event data group
// ------------------------------------------------------------------------
fUstComposite = null;
fKernelComposite = null;
} else {
createUstComposite();
}
-
+
fKernelButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
}
}
});
-
+
fDialogComposite.layout();
-
+
getShell().setMinimumSize(new Point(500, 650));
-
+
return fDialogComposite;
}
-
+
/*
* (non-Javadoc)
if (fKernelComposite != null && !fKernelComposite.isValid()) {
return;
}
-
+
// Validate UST composite in case of UST domain
if (fUstComposite != null && !fUstComposite.isValid()) {
return;
}
-
+
// validation successful -> call super.okPressed()
super.okPressed();
}
-
+
// ------------------------------------------------------------------------
// Helper methods
// ------------------------------------------------------------------------
* Creates the UST composite (if not existing)
*/
private void createUstComposite() {
- if (fUstComposite == null) {
+ if (fUstComposite == null) {
fUstComposite = new EnableUstEventsComposite(fDialogComposite, SWT.NONE, fProviderGroup);
GridLayout layout = new GridLayout(1, true);
fUstComposite.setLayout(layout);
/**********************************************************************
* 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;
* <p>
* A composite for collecting information about kernel events to be enabled.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class EnableKernelEventComposite extends Composite implements IEnableKernelEvents {
// ------------------------------------------------------------------------
// Constants
// ------------------------------------------------------------------------
- private enum KernelGroupEnum { TRACEPOINTS, SYSCALLS, PROBE, FUNCTION };
+ private enum KernelGroupEnum { TRACEPOINTS, SYSCALLS, PROBE, FUNCTION }
// ------------------------------------------------------------------------
// Attributes
*/
private Button fProbeActivateButton;
/**
- * The text field for the event name for the dynamic probe.
+ * The text field for the event name for the dynamic probe.
*/
private Text fProbeEventNameText;
/**
*/
private Button fFunctionActivateButton;
/**
- * The text field for the event name for the dynamic probe.
+ * The text field for the event name for the dynamic probe.
*/
private Text fFunctionEventNameText;
/**
*/
private Text fFunctionText;
/**
- * The referenced trace provider group containing the kernel provider
+ * The referenced trace provider group containing the kernel provider
* component which contains a list of available tracepoints.
*/
- private TraceProviderGroup fProviderGroup;
+ private final TraceProviderGroup fProviderGroup;
/**
* The flag indicating that tracepoints are selected.
*/
*/
private boolean fIsDynamicProbe;
/**
- * The event name of the dynamic probe.
+ * The event name of the dynamic probe.
*/
private String fProbeEventName;
/**
// Constructors
// ------------------------------------------------------------------------
+ /**
+ * Constructor
+ *
+ * @param parent
+ * The parent composite
+ * @param style
+ * The index of the style for this event composite
+ * @param providerGroup
+ * The trace provider group
+ */
public EnableKernelEventComposite(Composite parent, int style, TraceProviderGroup providerGroup) {
super(parent, style);
fProviderGroup = providerGroup;
public boolean isTracepoints() {
return fIsTracepoints;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#isAllTracePoints()
*/
public boolean isAllTracePoints() {
return fIsAllTracepoints;
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#isSysCalls()
public boolean isSysCalls() {
return fIsSysCalls;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#isAllSysCalls()
*/
public boolean isAllSysCalls() {
return fIsSysCalls;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#getEventNames()
*/
public boolean isDynamicProbe() {
return fIsDynamicProbe;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#getProbeName()
*/
public String getProbeName() {
return fProbeString;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#getProbeEventName()
*/
public String getProbeEventName() {
return fProbeEventName;
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#isDynamicFunctionProbe()
public boolean isDynamicFunctionProbe() {
return fIsDynamicFunctionProbe;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#getFunctionEventName()
*/
public String getFunctionEventName() {
return fFunctionEventName;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#getFunction()
*/
* Creates the composite content
*/
public void createContent() {
-
- // Tracepoints Group
+
+ // Tracepoints Group
createTracepointsGroup();
- // Syscalls Group
+ // Syscalls Group
createSysCallsGroup();
-
- // Dynamic Probe Group
+
+ // Dynamic Probe Group
createDynamicProbeGroup();
- // Dynamic Function Probe Group
+ // Dynamic Function Probe Group
createDynamicFunctionPropeGroup();
-
+
// Set default enablements
setKernelEnablements(KernelGroupEnum.TRACEPOINTS);
}
-
+
/**
* Validates the kernel composite input data.
* @return true if configured data is valid and can be retrieved.
fProbeEventName = temp;
// fProbeString will be validated by lttng-tools
fProbeString = fProbeText.getText();
- }
+ }
}
// initialize function string
return true;
}
-
+
/**
* Creates tracepoints group.
*/
// Local classes
// ------------------------------------------------------------------------
/**
- * Content provider for the tracepoints tree.
+ * Content provider for the tracepoints tree.
*/
final static public class KernelContentProvider extends TraceControlContentProvider {
@Override
public Object[] getChildren(Object parentElement) {
if (parentElement instanceof TraceProviderGroup) {
List<ITraceControlComponent> children = ((ITraceControlComponent)parentElement).getChildren(KernelProviderComponent.class);
- return (ITraceControlComponent[]) children.toArray(new ITraceControlComponent[children.size()]);
+ return children.toArray(new ITraceControlComponent[children.size()]);
}
if (parentElement instanceof ITraceControlComponent) {
return ((ITraceControlComponent)parentElement).getChildren();
return new Object[0];
}
}
-
+
/**
- * Content label for the tracepoints tree.
+ * Content label for the tracepoints tree.
*/
final static public class KernelLabelProvider extends TraceControlLabelProvider {
@Override
return super.getText(element);
}
}
-
+
/**
- * Check state listener for the tracepoints tree.
+ * Check state listener for the tracepoints tree.
*/
final public class KernelCheckListener implements ICheckStateListener {
@Override
if (event.getChecked()) {
if (event.getElement() instanceof KernelProviderComponent) {
fTracepointsViewer.setSubtreeChecked(event.getElement(), true);
- }
- } else {
+ }
+ } else {
if (event.getElement() instanceof KernelProviderComponent) {
fTracepointsViewer.setSubtreeChecked(event.getElement(), false);
} else {
/**********************************************************************
* 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;
* <p>
* A composite for collecting information about UST events to be enabled.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class EnableUstEventsComposite extends Composite implements IEnableUstEvents {
// ------------------------------------------------------------------------
// Constants
// ------------------------------------------------------------------------
-
- private enum GroupEnum { TRACEPOINTS, WILDCARD, LOGLEVEL };
-
+
+ private enum GroupEnum { TRACEPOINTS, WILDCARD, LOGLEVEL }
+
// ------------------------------------------------------------------------
// Attributes
// ------------------------------------------------------------------------
-
+
/**
* A button to enable/disable the tracepoints group
*/
*/
private Button fLogLevelOnlyButton;
/**
- * The referenced trace provider group containing the UST providers
+ * The referenced trace provider group containing the UST providers
* component which contains a list of available tracepoints.
*/
- private TraceProviderGroup fProviderGroup;
+ private final TraceProviderGroup fProviderGroup;
/**
* The flag indicating that tracepoints are selected.
*/
*/
private List<String> fSelectedEvents;
/**
- * The flag indicating that all wildcard are selected..
+ * The flag indicating that all wildcard are selected..
*/
private boolean fIsWildcard;
/**
- * The wildcard if wildcard is selected.
+ * The wildcard if wildcard is selected.
*/
private String fWildcard;
/**
- *The flag indicating that all log level are selected.
+ *The flag indicating that all log level are selected.
*/
private boolean fIsLogLevel;
/**
/**
* Constructor
* @param parent - a parent composite
- * @Param style - a compsite style
+ * @param style - a composite style
* @param providerGroup - the trace provider group
*/
public EnableUstEventsComposite(Composite parent, int style, TraceProviderGroup providerGroup) {
public boolean isTracepoints() {
return fIsTracepoints;
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableUstEvents#isAllTracePoints()
public boolean isAllTracePoints() {
return fIsAllTracepoints;
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableUstEvents#getEventNames()
public String getLogLevelEventName() {
return fLogLevelEventName;
}
-
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
+ /**
+ * Create the contents of this event composite
+ */
public void createContent() {
-
- // Tracepoints Group
+
+ // Tracepoints Group
createTracepointsGroup();
- // Wildcard Group
+ // Wildcard Group
createWildCardGroup();
- // Log Level Group
+ // Log Level Group
createLogLevelGroup();
-
+
// Set default enablements
setEnablements(GroupEnum.TRACEPOINTS);
}
* @return true if configured data is valid and can be retrieved.
*/
public boolean isValid() {
-
+
fIsTracepoints = fTracepointsActivateButton.getSelection();
fIsWildcard = fWildcardActivateButton.getSelection();
fIsLogLevel = fLogLevelActivateButton.getSelection();
-
+
// initialize tracepoint fields
fIsAllTracepoints = false;
fSelectedEvents = new ArrayList<String>();
Messages.TraceControl_InvalidLogLevel + " (" + temp + ") \n"); //$NON-NLS-1$ //$NON-NLS-2$
return false;
- } else {
- fLogLevel = levels[id];
}
+ fLogLevel = levels[id];
}
// initialize wildcard with the event name string
// validation successful -> call super.okPressed()
return true;
}
-
+
// ------------------------------------------------------------------------
// Helper methods
// ------------------------------------------------------------------------
-
+
/**
* Creates tracepoints group.
*/
tpMainGroup.setLayout(layout);
GridData data = new GridData(GridData.FILL_BOTH);
tpMainGroup.setLayoutData(data);
-
+
Composite buttonComposite = new Composite(tpMainGroup, SWT.NONE);
layout = new GridLayout(1, true);
buttonComposite.setLayout(layout);
setEnablements(GroupEnum.TRACEPOINTS);
}
});
-
+
Group tpGroup = new Group(tpMainGroup, SWT.SHADOW_NONE);
layout = new GridLayout(1, true);
tpGroup.setLayout(layout);
data = new GridData(GridData.FILL_BOTH);
tpGroup.setLayoutData(data);
-
+
fTracepointsViewer = new CheckboxTreeViewer(tpGroup, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
fTracepointsViewer.getTree().setToolTipText(Messages.TraceControl_EnableEventsTracepointTreeTooltip);
fTracepointsViewer.setContentProvider(new UstContentProvider());
fTracepointsViewer.setInput(fProviderGroup.getParent());
fTracepointsViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
}
-
+
/**
* Creates wildcard group.
*/
wildcardMainGroup.setLayout(layout);
GridData data = new GridData(GridData.FILL_HORIZONTAL);
wildcardMainGroup.setLayoutData(data);
-
+
Composite buttonComposite = new Composite(wildcardMainGroup, SWT.NONE);
layout = new GridLayout(1, false);
buttonComposite.setLayout(layout);
setEnablements(GroupEnum.WILDCARD);
}
});
-
+
Group wildcardGroup = new Group(wildcardMainGroup, SWT.SHADOW_NONE);
layout = new GridLayout(3, true);
wildcardGroup.setLayout(layout);
data = new GridData(GridData.FILL_HORIZONTAL);
wildcardGroup.setLayoutData(data);
-
+
Label wildcardLabel = new Label(wildcardGroup, SWT.LEFT);
wildcardLabel.setText(Messages.TraceControl_EnableEventsWildcardLabel);
data = new GridData(GridData.FILL_HORIZONTAL);
data.horizontalSpan = 1;
wildcardLabel.setLayoutData(data);
-
+
fWildcardText = new Text(wildcardGroup, SWT.LEFT);
fWildcardText.setToolTipText(Messages.TraceControl_EnableEventsWildcardTooltip);
data = new GridData(GridData.FILL_HORIZONTAL);
data.horizontalSpan = 2;
fWildcardText.setLayoutData(data);
}
-
+
/**
* Creates log level group.
*/
logLevelMainGroup.setLayout(layout);
GridData data = new GridData(GridData.FILL_HORIZONTAL);
logLevelMainGroup.setLayoutData(data);
-
+
Composite buttonComposite = new Composite(logLevelMainGroup, SWT.NONE);
layout = new GridLayout(1, false);
buttonComposite.setLayout(layout);
fLogLevelEventNameText.setLayoutData(data);
TraceLogLevel[] levels = TraceLogLevel.values();
-
+
String[] levelNames = new String[levels.length - 1];
int k = 0;
for (int i = 0; i < levels.length; i++) {
data = new GridData(GridData.FILL_BOTH);
fLogLevelButton.setLayoutData(data);
}
-
+
/**
* Enable/selects widgets depending on the group specified.
* @param group - group to enable.
*/
private void setEnablements(GroupEnum group) {
-
+
// Enable/disable trace point items
fTracepointsActivateButton.setSelection(group == GroupEnum.TRACEPOINTS);
fTracepointsViewer.getTree().setEnabled(group == GroupEnum.TRACEPOINTS);
-
+
// Enable/disable wildcard items
fWildcardActivateButton.setSelection(group == GroupEnum.WILDCARD);
fWildcardText.setEnabled(group == GroupEnum.WILDCARD);
// Local classes
// ------------------------------------------------------------------------
/**
- * Content provider for the tracepoints tree.
+ * Content provider for the tracepoints tree.
*/
final static public class UstContentProvider extends TraceControlContentProvider {
@Override
public Object[] getChildren(Object parentElement) {
if (parentElement instanceof TargetNodeComponent) {
List<ITraceControlComponent> children = ((ITraceControlComponent)parentElement).getChildren(TraceProviderGroup.class);
- return (ITraceControlComponent[]) children.toArray(new ITraceControlComponent[children.size()]);
+ return children.toArray(new ITraceControlComponent[children.size()]);
}
if (parentElement instanceof TraceProviderGroup) {
List<ITraceControlComponent> children = ((ITraceControlComponent)parentElement).getChildren(UstProviderComponent.class);
- return (ITraceControlComponent[]) children.toArray(new ITraceControlComponent[children.size()]);
+ return children.toArray(new ITraceControlComponent[children.size()]);
}
if (parentElement instanceof ITraceControlComponent) {
return ((ITraceControlComponent)parentElement).getChildren();
return new Object[0];
}
}
-
+
/**
- * Content label for the tracepoints tree.
+ * Content label for the tracepoints tree.
*/
final static public class UstLabelProvider extends TraceControlLabelProvider {
@Override
}
/**
- * Check state listener for the tracepoints tree.
+ * Check state listener for the tracepoints tree.
*/
final public class UstCheckStateListener implements ICheckStateListener {
@Override
}
if (event.getElement() instanceof UstProviderComponent) {
fTracepointsViewer.setSubtreeChecked(event.getElement(), true);
- }
+ }
} else {
if (event.getElement() instanceof TraceProviderGroup) {
fTracepointsViewer.setSubtreeChecked(event.getElement(), true);
/**********************************************************************
* 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;
* <p>
* Interface for a confirmation dialog.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public interface IConfirmDialog {
-
+
+ /**
+ * Open a confirmation dialog
+ *
+ * @param parent
+ * The parent shell
+ * @param title
+ * The title of the dialog window
+ * @param message
+ * The message in the dialog window
+ * @return If the user clicked OK (true) or Cancel (false)
+ */
public boolean openConfirm(Shell parent, String title, String message);
-
+
}
/**********************************************************************
* 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;
* <p>
* Interface for import traces dialog.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public interface IImportDialog {
-
+
// ------------------------------------------------------------------------
// Accessors
// ------------------------------------------------------------------------
* @return the project to import the traces to
*/
public IProject getProject();
-
+
/**
* Sets the session containing the traces to import
- * @param session
+ * @param session The trace session
*/
public void setSession(TraceSessionComponent session);
-
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
/**********************************************************************
* 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;
* <p>
* Dialog box for collecting trace import information.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class ImportDialog extends Dialog implements IImportDialog {
// ------------------------------------------------------------------------
// Constants
// ------------------------------------------------------------------------
- /**
- * The icon file for this dialog box.
- */
+ /** The icon file for this dialog box. */
public static final String IMPORT_ICON_FILE = "icons/elcl16/import_trace.gif"; //$NON-NLS-1$
-
+
+ /** Parent directory for UST traces */
public static final String UST_PARENT_DIRECTORY = "ust"; //$NON-NLS-1$
// ------------------------------------------------------------------------
*/
private CCombo fCombo;
/**
- * The overwrite button
+ * The overwrite button
*/
private Button fOverwriteButton;
/**
*/
private TraceSessionComponent fSession = null;
/**
- * List of traces to import
+ * List of traces to import
*/
- private List<ImportFileInfo> fTraces = new ArrayList<ImportFileInfo>();
+ private final List<ImportFileInfo> fTraces = new ArrayList<ImportFileInfo>();
/**
- * Selection index in project combo box.
+ * Selection index in project combo box.
*/
private int fProjectIndex;
/**
* Flag to indicate that something went wrong when creating the dialog box.
*/
private boolean fIsError = false;
-
+
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
public IProject getProject() {
return fProjects.get(fProjectIndex);
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IImportDialog#setSession(org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceSessionComponent)
*/
@Override
protected Control createDialogArea(Composite parent) {
-
+
// Main dialog panel
fDialogComposite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout(1, true);
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 {
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) {
return;
}
fFolderViewer.setSubtreeChecked(event.getElement(), event.getChecked());
- if (!event.getChecked()) {
+ if (!event.getChecked()) {
fFolderViewer.setChecked(element.getParentRemoteFile(), false);
}
}
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);
getShell().setMinimumSize(new Point(500, 400));
-
+
} catch (SystemMessageException e) {
createErrorComposite(parent, e.fillInStackTrace());
return fDialogComposite;
}
-
+
return fDialogComposite;
}
Object[] checked = fFolderViewer.getCheckedElements();
for (int i = 0; i < checked.length; i++) {
IRemoteFile file = (IRemoteFile) checked[i];
-
- // Only add actual trace directories
+
+ // Only add actual trace directories
if (file.isDirectory() && !UST_PARENT_DIRECTORY.equals(file.getName())) {
-
+
ImportFileInfo info = new ImportFileInfo(file, file.getName(), overwriteAll);
String traceName = info.getLocalTraceName();
IFolder folder = traceFolder.getFolder(traceName);
- // Verify if trace directory already exists (and not overwrite)
+ // Verify if trace directory already exists (and not overwrite)
if (folder.exists() && !overwriteAll) {
// Ask user for overwrite or new name
}
fTraces.add(info);
}
- } else {
+ } else {
fTraces.add(info);
}
}
// ------------------------------------------------------------------------
// Helper methods and classes
// ------------------------------------------------------------------------
+ /**
+ * Helper class for the contents of a folder in a tracing project
+ *
+ * @author Bernd Hufmann
+ */
public static class FolderContentProvider extends WorkbenchContentProvider {
@Override
public Object[] getChildren(Object o) {
return super.getChildren(o);
}
}
-
+
/**
* Creates a dialog composite with an error message which can be used
* when an exception occurred during creation time of the dialog box.
* @param parent - a parent composite
- * @param e - a error causing exception
+ * @param e - a error causing exception
*/
private void createErrorComposite(Composite parent, Throwable e) {
fIsError = true;
fDialogComposite.dispose();
-
+
fDialogComposite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout(1, true);
fDialogComposite.setLayout(layout);
fDialogComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
+
Text errorText = new Text(fDialogComposite, SWT.MULTI);
StringBuffer error = new StringBuffer();
error.append(Messages.TraceControl_ImportDialogCreationError);
errorText.setLayoutData(new GridData(GridData.FILL_BOTH));
}
-
+
}
/**********************************************************************
* 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;
* <p>
* Helper class for storing information about a remote file to import.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class ImportFileInfo {
}
/**
* Sets the overwrite flag.
- * @param isOverwrite
+ * @param isOverwrite If the Overwrite checkbox is checked or not
*/
public void setOverwrite(boolean isOverwrite) {
this.fIsOverwrite = isOverwrite;
}
/**
* Sets the remote file implementation
- * @param the remote file implementation.
+ * @param remoteFile The remote file implementation.
*/
public void setRemoteFile(IRemoteFile remoteFile) {
fRemoteFile = remoteFile;
/**********************************************************************
* 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;
* <p>
* Dialog box for connection information.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class NewConnectionDialog extends Dialog implements INewConnectionDialog {
/**
* The icon file for this dialog box.
*/
- public static final String TARGET_NEW_CONNECTION_ICON_FILE = "icons/elcl16/target_add.gif"; //$NON-NLS-1$
+ public static final String TARGET_NEW_CONNECTION_ICON_FILE = "icons/elcl16/target_add.gif"; //$NON-NLS-1$
// ------------------------------------------------------------------------
// Attributes
* The node address (IP or DNS name) string.
*/
private String fHostName = null;
-
+
/**
* Input list of existing RSE hosts available for selection.
*/
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
+ /**
+ * Constructor
+ *
+ * @param shell
+ * The shell
+ */
public NewConnectionDialog(Shell shell) {
super(shell);
setShellStyle(SWT.RESIZE);
public String getHostName() {
return fHostName;
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.INewConnectionDialog#setTraceControlParent(org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponent)
public void setTraceControlParent(ITraceControlComponent parent) {
fParent = parent;
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.INewConnectionDialog#setHosts(org.eclipse.rse.core.model.IHost[])
*/
@Override
protected Control createDialogArea(Composite parent) {
-
+
// Main dialog panel
fDialogComposite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout(1, true);
fComboGroup = new Group(fDialogComposite, SWT.SHADOW_NONE);
fComboGroup.setText(Messages.TraceControl_NewNodeExistingConnectionGroupName);
layout = new GridLayout(2, true);
- fComboGroup.setLayout(layout);
+ fComboGroup.setLayout(layout);
GridData data = new GridData(GridData.FILL_HORIZONTAL);
fComboGroup.setLayoutData(data);
-
+
fExistingHostsCombo = new CCombo(fComboGroup, SWT.READ_ONLY);
fExistingHostsCombo.setToolTipText(Messages.TraceControl_NewNodeComboToolTip);
fExistingHostsCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1));
fTextGroup.setLayout(layout);
data = new GridData(GridData.FILL_HORIZONTAL);
fTextGroup.setLayoutData(data);
-
+
fButton = new Button(fTextGroup, SWT.CHECK);
fButton.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 3, 1));
fButton.setText(Messages.TraceControl_NewNodeEditButtonName);
fButton.setEnabled(fExistingHosts.length > 0);
-
+
Label connectionNameLabel = new Label(fTextGroup, SWT.RIGHT);
connectionNameLabel.setText(Messages.TraceControl_NewNodeConnectionNameLabel);
fConnectionNameText = new Text(fTextGroup, SWT.NONE);
fConnectionNameText.setToolTipText(Messages.TraceControl_NewNodeConnectionNameTooltip);
fConnectionNameText.setEnabled(fExistingHosts.length == 0);
-
+
Label hostNameLabel = new Label(fTextGroup, SWT.RIGHT);
hostNameLabel.setText(Messages.TraceControl_NewNodeHostNameLabel);
fHostNameText = new Text(fTextGroup, SWT.NONE);
fExistingHostsCombo.setEnabled(true);
fConnectionNameText.setEnabled(false);
fHostNameText.setEnabled(false);
- }
+ }
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
}
});
-
+
// layout widgets
data = new GridData(GridData.FILL_HORIZONTAL);
fHostNameText.setText("666.666.666.666"); //$NON-NLS-1$
Point minSize = fHostNameText.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
data.widthHint = minSize.x + 5;
data.horizontalSpan = 2;
-
+
fConnectionNameText.setLayoutData(data);
fHostNameText.setLayoutData(data);
-
+
fHostNameText.setText(""); //$NON-NLS-1$
-
+
return fDialogComposite;
}
/**********************************************************************
* 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.handlers;
* <p>
* Command handler implementation to add contexts to a given channel and all of its events.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class AddContextOnChannelHandler extends BaseAddContextHandler {
// ------------------------------------------------------------------------
// Attributes
// ------------------------------------------------------------------------
-
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
if (selection instanceof StructuredSelection) {
StructuredSelection structered = ((StructuredSelection) selection);
for (Iterator<?> iterator = structered.iterator(); iterator.hasNext();) {
- Object element = (Object) iterator.next();
+ Object element = iterator.next();
if (element instanceof TraceChannelComponent) {
// Add only if corresponding TraceSessionComponents is inactive and not destroyed
- TraceChannelComponent tmpChannel = (TraceChannelComponent) element;
+ TraceChannelComponent tmpChannel = (TraceChannelComponent) element;
session = tmpChannel.getSession();
if(session.getSessionState() == TraceSessionState.INACTIVE && !session.isDestroyed()) {
channel = tmpChannel;
}
}
}
-
+
boolean isEnabled = (channel != null);
fLock.lock();
try {
/**********************************************************************
* 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.handlers;
* <p>
* Command handler implementation to add contexts to all channels and all events.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class AddContextOnDomainHandler extends BaseAddContextHandler {
// ------------------------------------------------------------------------
// Attributes
// ------------------------------------------------------------------------
-
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
*/
@Override
public boolean isEnabled() {
-
+
// Get workbench page for the Control View
IWorkbenchPage page = getWorkbenchPage();
if (page == null) {
return false;
}
-
+
TraceDomainComponent domain = null;
TraceSessionComponent session = null;
-
+
// Check if one domain is selected
ISelection selection = page.getSelection(ControlView.ID);
if (selection instanceof StructuredSelection) {
StructuredSelection structered = ((StructuredSelection) selection);
for (Iterator<?> iterator = structered.iterator(); iterator.hasNext();) {
- Object element = (Object) iterator.next();
+ Object element = iterator.next();
if (element instanceof TraceDomainComponent) {
TraceDomainComponent tmpDomain = (TraceDomainComponent) element;
session = (TraceSessionComponent) tmpDomain.getParent();
-
+
// Add only TraceDomainComponent whose TraceSessionComponent parent is inactive and not destroyed
if ((session.getSessionState() == TraceSessionState.INACTIVE) && (!session.isDestroyed())) {
domain = tmpDomain;
}
}
}
-
+
boolean isEnabled = domain != null;
-
+
fLock.lock();
try {
fParam = null;
/**********************************************************************
* 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.handlers;
* <p>
* Command handler implementation to add contexts to a given event.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class AddContextOnEventHandler extends BaseAddContextHandler {
// ------------------------------------------------------------------------
// Attributes
// ------------------------------------------------------------------------
-
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
if (selection instanceof StructuredSelection) {
StructuredSelection structered = ((StructuredSelection) selection);
for (Iterator<?> iterator = structered.iterator(); iterator.hasNext();) {
- Object element = (Object) iterator.next();
+ Object element = iterator.next();
if (element instanceof TraceEventComponent) {
// Add only if corresponding TraceSessionComponents is inactive and not destroyed
- TraceEventComponent tmpEvent = (TraceEventComponent) element;
+ TraceEventComponent tmpEvent = (TraceEventComponent) element;
session = tmpEvent.getSession();
if(session.getSessionState() == TraceSessionState.INACTIVE && !session.isDestroyed()) {
event = tmpEvent;
}
}
}
-
+
boolean isEnabled = (event != null);
fLock.lock();
try {
/**********************************************************************
* 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.handlers;
* Command handler implementation to assign events to a session and channel and enable/configure them.
* This is done on the trace provider level.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class AssignEventHandler extends BaseControlViewHandler {
* The command execution parameter.
*/
private Parameter fParam;
-
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
List<BaseEventComponent> events = param.getEvents();
// Create list of event names
for (Iterator<BaseEventComponent> iterator = events.iterator(); iterator.hasNext();) {
- BaseEventComponent event = (BaseEventComponent) iterator.next();
+ BaseEventComponent event = iterator.next();
eventNames.add(event.getName());
}
refresh(new CommandParameter(dialog.getSession()));
if (error != null) {
- return new Status(Status.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_EnableEventsFailure, error);
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_EnableEventsFailure, error);
}
return Status.OK_STATUS;
}
// Check if one or more session are selected
ISelection selection = page.getSelection(ControlView.ID);
if (selection instanceof StructuredSelection) {
-
+
StructuredSelection structered = ((StructuredSelection) selection);
for (Iterator<?> iterator = structered.iterator(); iterator.hasNext();) {
- Object element = (Object) iterator.next();
+ Object element = iterator.next();
if (element instanceof BaseEventComponent) {
BaseEventComponent event = (BaseEventComponent) element;
ITraceControlComponent provider = event.getParent();
-
+
// check for kernel or UST provider
boolean temp = false;
if (provider instanceof KernelProviderComponent) {
// Add BaseEventComponents
events.add(event);
-
+
if (sessions == null) {
TargetNodeComponent root = (TargetNodeComponent)event.getParent().getParent().getParent();
sessions = root.getSessions();
}
/**
- * Class containing parameter for the command execution.
+ * Class containing parameter for the command execution.
*/
final static private class Parameter {
/**
- * The list of event components the command is to be executed on.
+ * The list of event components the command is to be executed on.
*/
- private List<BaseEventComponent> fEvents;
-
+ private final List<BaseEventComponent> fEvents;
+
/**
* The list of available sessions.
*/
final private TraceSessionComponent[] fSessions;
-
+
/**
* Flag for indicating Kernel or UST.
*/
final private boolean fIsKernel;
-
+
/**
* Constructor
- *
+ *
* @param sessions - a array of trace sessions
* @param events - a lists of events to enable
* @param isKernel - domain (true for kernel or UST)
fEvents.addAll(events);
fIsKernel = isKernel;
}
-
+
/**
* Copy constructor
* @param other - a parameter to copy
public Parameter(Parameter other) {
this(other.fSessions, other.fEvents, other.fIsKernel);
}
-
+
public TraceSessionComponent[] getSessions() {
return fSessions;
}
-
+
public List<BaseEventComponent> getEvents() {
return fEvents;
}
-
+
public boolean isKernel() {
return fIsKernel;
}
/**********************************************************************
* 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.handlers;
* <p>
* Base command handler implementation to add contexts.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
abstract public class BaseAddContextHandler extends BaseControlViewHandler {
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
-
+
/**
- * Adds contexts to channel(s) and/or event(s)
- * @param param - a parameter instance with data for the command execution
- * @param contextNames - list contexts to add
- * @param monitor - a progress monitor
+ * Adds contexts to channel(s) and/or event(s)
+ *
+ * @param param
+ * - a parameter instance with data for the command execution
+ * @param contextNames
+ * - list contexts to add
+ * @param monitor
+ * - a progress monitor
* @throws ExecutionException
+ * If something goes wrong
*/
abstract public void addContexts(CommandParameter param, List<String> contextNames, IProgressMonitor monitor) throws ExecutionException;
-
+
/*
* (non-Javadoc)
* @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
try {
final List<String> availableContexts = param.getSession().getContextList(monitor);
final IAddContextDialog dialog = TraceControlDialogFactory.getInstance().getAddContextDialog();
- dialog.setAvalibleContexts(availableContexts);
+ dialog.setAvalibleContexts(availableContexts);
if ((dialog.open() != Window.OK) || (dialog.getContexts().isEmpty())) {
return Status.OK_STATUS;
// get session configuration in all cases
refresh(param);
-
+
if (error != null) {
- return new Status(Status.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_AddContextFailure, error);
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_AddContextFailure, error);
}
return Status.OK_STATUS;
}
addJob.setUser(true);
addJob.schedule();
} catch (ExecutionException e) {
- return new Status(Status.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_GetContextFailure, e);
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_GetContextFailure, e);
}
return Status.OK_STATUS;
/**********************************************************************
* 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.handlers;
* <p>
* Abstract Command handler implementation for all control view handlers.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
abstract public class BaseControlViewHandler extends AbstractHandler {
* The synchronization lock.
*/
final protected ReentrantLock fLock = new ReentrantLock();
-
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
*/
protected void refresh(final CommandParameter param) {
Job job = new Job(Messages.TraceControl_RetrieveNodeConfigurationJob) {
-
+
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
param.getSession().getConfigurationFromNode(monitor);
} catch (ExecutionException e) {
- return new Status(Status.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_ListSessionFailure, e);
- }
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_ListSessionFailure, e);
+ }
return Status.OK_STATUS;
}
};
/**********************************************************************
* 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.handlers;
/**
* <p>
- * Base implementation of a command handler to enable a trace channel.
+ * Base implementation of a command handler to enable a trace channel.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
abstract class BaseEnableChannelHandler extends BaseControlViewHandler {
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
+
/**
- * Enables channels with given names which are part of this domain. If a given channel
- * doesn't exists it creates a new channel with the given parameters (or default values
- * if given parameter is null).
- * @param - a parameter instance with data for the command execution
- * @param channelNames - a list of channel names to enable on this domain
- * @param info - channel information to set for the channel (use null for default)
- * @param isKernel - a flag for indicating kernel or UST.
- * @param monitor - a progress monitor
+ * Enables channels with given names which are part of this domain. If a
+ * given channel doesn't exists it creates a new channel with the given
+ * parameters (or default values if given parameter is null).
+ *
+ * @param param
+ * - a parameter instance with data for the command execution
+ * @param channelNames
+ * - a list of channel names to enable on this domain
+ * @param info
+ * - channel information to set for the channel (use null for
+ * default)
+ * @param isKernel
+ * - a flag for indicating kernel or UST.
+ * @param monitor
+ * - a progress monitor
* @throws ExecutionException
+ * If something goes wrong when enabling the channel
*/
- abstract public void enableChannel(CommandParameter param, List<String> channelNames, IChannelInfo info, boolean isKernel, IProgressMonitor monitor) throws ExecutionException;
-
+ abstract public void enableChannel(CommandParameter param,
+ List<String> channelNames, IChannelInfo info, boolean isKernel,
+ IProgressMonitor monitor) throws ExecutionException;
+
/**
- * @param - a parameter instance with data for the command execution
+ * @param param - a parameter instance with data for the command execution
* @return returns the relevant domain (null if domain is not known)
*/
abstract public TraceDomainComponent getDomain(CommandParameter param);
protected IStatus run(IProgressMonitor monitor) {
Exception error = null;
- List<String> channelNames = new ArrayList<String>();
+ List<String> channelNames = new ArrayList<String>();
channelNames.add(dialog.getChannelInfo().getName());
try {
refresh(param);
if (error != null) {
- return new Status(Status.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_CreateChannelStateFailure, error);
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_CreateChannelStateFailure, error);
}
return Status.OK_STATUS;
}
/**********************************************************************
* 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.handlers;
* <p>
* Base command handler implementation to enable events.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
abstract public class BaseEnableEventHandler extends BaseControlViewHandler {
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
+
/**
* Enables a list of events for given parameters.
- * @param - a parameter instance with data for the command execution
- * @param eventNames - list of event names
- * @param isKernel - true if kernel domain else false
- * @param monitor - a progress monitor
+ *
+ * @param param
+ * - a parameter instance with data for the command execution
+ * @param eventNames
+ * - list of event names
+ * @param isKernel
+ * - true if kernel domain else false
+ * @param monitor
+ * - a progress monitor
* @throws ExecutionException
+ * If the command fails for some reason
*/
abstract public void enableEvents(CommandParameter param, List<String> eventNames, boolean isKernel, IProgressMonitor monitor) throws ExecutionException;
/**
* Enables all syscall events.
- * @param - a parameter instance with data for the command execution
- * @param monitor - a progress monitor
+ *
+ * @param param
+ * - a parameter instance with data for the command execution
+ * @param monitor
+ * - a progress monitor
* @throws ExecutionException
+ * If the command fails for some reason
*/
abstract public void enableSyscalls(CommandParameter param, IProgressMonitor monitor) throws ExecutionException;
-
+
/**
* Enables a dynamic probe.
- * @param - a parameter instance with data for the command execution
- * @param eventName - a event name
- * @param isFunction - true for dynamic function entry/return probe else false
- * @param probe - a dynamic probe information
- * @param monitor - a progress monitor
+ *
+ * @param param
+ * - a parameter instance with data for the command execution
+ * @param eventName
+ * - a event name
+ * @param isFunction
+ * - true for dynamic function entry/return probe else false
+ * @param probe
+ * - a dynamic probe information
+ * @param monitor
+ * - a progress monitor
* @throws ExecutionException
+ * If the command fails for some reason
*/
abstract public void enableProbe(CommandParameter param, String eventName, boolean isFunction, String probe, IProgressMonitor monitor) throws ExecutionException;
-
+
/**
* Enables events using log level
- * @param - a parameter instance with data for the command execution
- * @param eventName - a event name
- * @param logLevelType - a log level type
- * @param level - a log level
- * @param monitor - a progress monitor
+ *
+ * @param param
+ * - a parameter instance with data for the command execution
+ * @param eventName
+ * - a event name
+ * @param logLevelType
+ * - a log level type
+ * @param level
+ * - a log level
+ * @param monitor
+ * - a progress monitor
* @throws ExecutionException
- */
+ * If the command fails for some reason
+ */
abstract public void enableLogLevel(CommandParameter param, String eventName, LogLevelType logLevelType, TraceLogLevel level, IProgressMonitor monitor) throws ExecutionException;
-
+
/**
- * @param - a parameter instance with data for the command execution
+ * @param param
+ * - a parameter instance with data for the command execution
* @return returns the relevant domain (null if domain is not known)
*/
abstract TraceDomainComponent getDomain(CommandParameter param);
refresh(param);
if (error != null) {
- return new Status(Status.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_ChangeEventStateFailure, error);
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_ChangeEventStateFailure, error);
}
return Status.OK_STATUS;
}
/**********************************************************************
* 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.handlers;
* <p>
* Command handler implementation to execute command calibrate to quantify LTTng overhead.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class CalibrateHandler extends BaseControlViewHandler {
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
-
+
/*
* (non-Javadoc)
* @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
try {
param.getDomain().calibrate(monitor);
} catch (ExecutionException e) {
- return new Status(Status.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_AddCalibrateFailure, e);
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_AddCalibrateFailure, e);
}
return Status.OK_STATUS;
*/
@Override
public boolean isEnabled() {
-
+
// Get workbench page for the Control View
IWorkbenchPage page = getWorkbenchPage();
if (page == null) {
if (selection instanceof StructuredSelection) {
StructuredSelection structered = ((StructuredSelection) selection);
for (Iterator<?> iterator = structered.iterator(); iterator.hasNext();) {
- Object element = (Object) iterator.next();
+ Object element = iterator.next();
if (element instanceof TraceDomainComponent) {
TraceDomainComponent tmpDomain = (TraceDomainComponent) element;
session = (TraceSessionComponent) tmpDomain.getParent();
-
+
// Add only TraceDomainComponent whose TraceSessionComponent parent is not destroyed
if ((!session.isDestroyed())) {
domain = tmpDomain;
/**********************************************************************
* 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.handlers;
* <p>
* Abstract command handler implementation to enable or disabling a trace channel.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
abstract public class ChangeChannelStateHandler extends BaseControlViewHandler {
/**
* @return the new state to set
*/
- abstract protected TraceEnablement getNewState();
+ abstract protected TraceEnablement getNewState();
// ------------------------------------------------------------------------
// Operations
/**
* Changes the state of the given channels.
* @param domain - the domain of the channels.
- * @param channelNames - a list of channel names
+ * @param channelNames - a list of channel names
* @param monitor - a progress monitor
* @throws ExecutionException
*/
- abstract protected void changeState(TraceDomainComponent domain, List<String> channelNames, IProgressMonitor monitor) throws ExecutionException;
+ abstract protected void changeState(TraceDomainComponent domain, List<String> channelNames, IProgressMonitor monitor) throws ExecutionException;
/*
* (non-Javadoc)
List<String> channelNames = new ArrayList<String>();
for (Iterator<TraceChannelComponent> iterator = kernelChannels.iterator(); iterator.hasNext();) {
// Enable all selected channels which are disabled
- TraceChannelComponent channel = (TraceChannelComponent) iterator.next();
+ TraceChannelComponent channel = iterator.next();
channelNames.add(channel.getName());
}
for (Iterator<TraceChannelComponent> iterator = kernelChannels.iterator(); iterator.hasNext();) {
// Enable all selected channels which are disabled
- TraceChannelComponent channel = (TraceChannelComponent) iterator.next();
+ TraceChannelComponent channel = iterator.next();
channel.setState(getNewState());
}
}
List<String> channelNames = new ArrayList<String>();
for (Iterator<TraceChannelComponent> iterator = ustChannels.iterator(); iterator.hasNext();) {
// Enable all selected channels which are disabled
- TraceChannelComponent channel = (TraceChannelComponent) iterator.next();
+ TraceChannelComponent channel = iterator.next();
channelNames.add(channel.getName());
}
for (Iterator<TraceChannelComponent> iterator = ustChannels.iterator(); iterator.hasNext();) {
// Enable all selected channels which are disabled
- TraceChannelComponent channel = (TraceChannelComponent) iterator.next();
+ TraceChannelComponent channel = iterator.next();
channel.setState(getNewState());
}
}
error = e;
}
- // In all cases notify listeners
+ // In all cases notify listeners
session.fireComponentChanged(session);
if (error != null) {
- return new Status(Status.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_ChangeChannelStateFailure, error);
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_ChangeChannelStateFailure, error);
}
return Status.OK_STATUS;
TraceDomainComponent ustDomain = null;
List<TraceChannelComponent> kernelChannels = new ArrayList<TraceChannelComponent>();
List<TraceChannelComponent> ustChannels = new ArrayList<TraceChannelComponent>();
-
+
// Check if one or more session are selected
ISelection selection = page.getSelection(ControlView.ID);
if (selection instanceof StructuredSelection) {
StructuredSelection structered = ((StructuredSelection) selection);
String sessionName = null;
for (Iterator<?> iterator = structered.iterator(); iterator.hasNext();) {
- Object element = (Object) iterator.next();
-
+ Object element = iterator.next();
+
if (element instanceof TraceChannelComponent) {
-
+
// Add only TraceChannelComponents that are disabled
TraceChannelComponent channel = (TraceChannelComponent) element;
if (sessionName == null) {
}
}
}
-
+
boolean isEnabled = (!kernelChannels.isEmpty() || !ustChannels.isEmpty());
fLock.lock();
try {
} finally {
fLock.unlock();
}
-
+
return isEnabled;
}
-
+
/**
- * Class containing parameter for the command execution.
+ * Class containing parameter for the command execution.
*/
static protected class Parameter {
/**
*/
final protected TraceDomainComponent fUstDomain;
/**
- * The list of kernel channel components the command is to be executed on.
+ * The list of kernel channel components the command is to be executed on.
*/
final protected List<TraceChannelComponent> fKernelChannels;
/**
- * The list of UST channel components the command is to be executed on.
+ * The list of UST channel components the command is to be executed on.
*/
final protected List<TraceChannelComponent> fUstChannels;
-
+
/**
* Constructor
* @param kernelDomain - a kernel domain component
fUstChannels = new ArrayList<TraceChannelComponent>();
fUstChannels.addAll(ustChannels);
}
-
+
/**
* Copy constructor
* @param other a parameter to copy
public Parameter(Parameter other) {
this(other.fKernelDomain, other.fUstDomain, other.fKernelChannels, other.fUstChannels);
}
-
+
/**
* @return the kernel domain component.
*/
public TraceDomainComponent getKernelDomain() {
return fKernelDomain;
}
-
+
/**
* @return the UST domain component.
*/
public TraceDomainComponent getUstDomain() {
return fUstDomain;
- }
-
+ }
+
/**
* @return the list of kernel channel components.
*/
public List<TraceChannelComponent> getKernelChannels() {
return fKernelChannels;
}
-
+
/**
* @return the list of UST channel components.
*/
/**********************************************************************
* 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.handlers;
* <p>
* Base Command handler implementation to enable or disabling a trace channel.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
abstract public class ChangeEventStateHandler extends BaseControlViewHandler {
* The command execution parameter.
*/
protected Parameter fParam;
-
+
// ------------------------------------------------------------------------
// Accessors
// ------------------------------------------------------------------------
/**
* @return the new state to set
*/
- abstract protected TraceEnablement getNewState();
+ abstract protected TraceEnablement getNewState();
// ------------------------------------------------------------------------
// Operations
/**
* Change the state
* @param channel - channel of events to be enabled
- * @param eventNames - list event names
+ * @param eventNames - list event names
* @param monitor - a progress monitor
* @throws ExecutionException
*/
- abstract protected void changeState(TraceChannelComponent channel, List<String> eventNames, IProgressMonitor monitor) throws ExecutionException;
+ abstract protected void changeState(TraceChannelComponent channel, List<String> eventNames, IProgressMonitor monitor) throws ExecutionException;
/*
* (non-Javadoc)
fLock.lock();
try {
-
+
final Parameter param = new Parameter(fParam);
Job job = new Job(Messages.TraceControl_ChangeChannelStateJob) {
session = param.getChannel().getSession();
List<String> eventNames = new ArrayList<String>();
List<TraceEventComponent> events = param.getEvents();
-
+
for (Iterator<TraceEventComponent> iterator = events.iterator(); iterator.hasNext();) {
// Enable/disable all selected channels which are disabled
- TraceEventComponent event = (TraceEventComponent) iterator.next();
+ TraceEventComponent event = iterator.next();
// Workaround for wildcard handling in lttng-tools
if ("*".equals(event.getName())) { //$NON-NLS-1$
isAll = true;
- } else {
+ } else {
eventNames.add(event.getName());
}
}
for (Iterator<TraceEventComponent> iterator = events.iterator(); iterator.hasNext();) {
// Enable all selected channels which are disabled
- TraceEventComponent ev = (TraceEventComponent) iterator.next();
+ TraceEventComponent ev = iterator.next();
ev.setState(getNewState());
}
}
}
if (session != null) {
- // In all cases notify listeners
+ // In all cases notify listeners
session.fireComponentChanged(session);
}
if (error != null) {
- return new Status(Status.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_ChangeEventStateFailure, error);
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_ChangeEventStateFailure, error);
}
return Status.OK_STATUS;
// Check if one or more session are selected
ISelection selection = page.getSelection(ControlView.ID);
-
+
TraceChannelComponent channel = null;
List<TraceEventComponent> events = new ArrayList<TraceEventComponent>();
StructuredSelection structered = ((StructuredSelection) selection);
String sessionName = null;
String channelName = null;
-
+
for (Iterator<?> iterator = structered.iterator(); iterator.hasNext();) {
- Object element = (Object) iterator.next();
-
+ Object element = iterator.next();
+
if (element instanceof TraceEventComponent) {
-
+
TraceEventComponent event = (TraceEventComponent) element;
if (sessionName == null) {
sessionName = String.valueOf(event.getSessionName());
}
-
+
if (channel == null) {
channel = (TraceChannelComponent)event.getParent();
}
}
/**
- * Class containing parameter for the command execution.
+ * Class containing parameter for the command execution.
*/
static protected class Parameter {
/**
*/
final private TraceChannelComponent fChannel;
/**
- * The list of kernel channel components the command is to be executed on.
+ * The list of kernel channel components the command is to be executed on.
*/
final private List<TraceEventComponent> fEvents = new ArrayList<TraceEventComponent>();
-
+
/**
* Constructor
* @param channel - a channel component
fChannel = channel;
fEvents.addAll(events);
}
-
+
/**
* Copy constructor
* @param other - a parameter to copy
public Parameter(Parameter other) {
this(other.fChannel, other.fEvents);
}
-
+
/**
* @return the trace channel component.
*/
public TraceChannelComponent getChannel() {
return fChannel;
}
-
+
/**
* @return a list of trace event components.
*/
/**********************************************************************
* 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.handlers;
* <p>
* Abstract command handler implementation to start or stop one or more trace sessions.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
abstract public class ChangeSessionStateHandler extends BaseControlViewHandler {
// Attributes
// ------------------------------------------------------------------------
/**
- * The list of session components the command is to be executed on.
+ * The list of session components the command is to be executed on.
*/
protected List<TraceSessionComponent> fSessions = new ArrayList<TraceSessionComponent>();
-
+
// ------------------------------------------------------------------------
// Accessors
// ------------------------------------------------------------------------
* @return new required state.
*/
abstract TraceSessionState getNewState();
-
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
-
+
/**
- * Performs the state change on given session.
- * @param session - a session which state is to be changed
- * @param monitor - a progress monitor
+ * Performs the state change on given session.
+ *
+ * @param session
+ * - a session which state is to be changed
+ * @param monitor
+ * - a progress monitor
+ * @throws ExecutionException
+ * If the command fails
*/
abstract public void changeState(TraceSessionComponent session, IProgressMonitor monitor) throws ExecutionException;
fLock.lock();
try {
-
+
final List<TraceSessionComponent> sessions = new ArrayList<TraceSessionComponent>();
sessions.addAll(fSessions);
for (Iterator<TraceSessionComponent> iterator = sessions.iterator(); iterator.hasNext();) {
// Start all selected sessions
- TraceSessionComponent session = (TraceSessionComponent) iterator.next();
+ TraceSessionComponent session = iterator.next();
changeState(session, monitor);
// Set Session state
session.fireComponentChanged(session);
}
} catch (ExecutionException e) {
- return new Status(Status.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_ChangeSessionStateFailure, e);
- }
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_ChangeSessionStateFailure, e);
+ }
return Status.OK_STATUS;
}
};
if (selection instanceof StructuredSelection) {
StructuredSelection structered = ((StructuredSelection) selection);
for (Iterator<?> iterator = structered.iterator(); iterator.hasNext();) {
- Object element = (Object) iterator.next();
+ Object element = iterator.next();
if (element instanceof TraceSessionComponent) {
// Add only TraceSessionComponents that are inactive and not destroyed
TraceSessionComponent session = (TraceSessionComponent) element;
/**********************************************************************
* 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.handlers;
/**
* Class containing parameter for the command execution.
- *
+ *
* @author Bernd Hufmann
*/
-public class ChannelCommandParameter extends CommandParameter implements Cloneable {
+public class ChannelCommandParameter extends CommandParameter {
// ------------------------------------------------------------------------
// Attributes
public TraceChannelComponent getChannel() {
return fChannel;
}
-
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
/**********************************************************************
* 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.handlers;
* <p>
* Command handler implementation to create a trace session.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class CreateSessionHandler extends BaseControlViewHandler {
// Attributes
// ------------------------------------------------------------------------
/**
- * The trace session group the command is to be executed on.
+ * The trace session group the command is to be executed on.
*/
private TraceSessionGroup fSessionGroup = null;
-
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
fLock.lock();
try {
- final TraceSessionGroup sessionGroup = fSessionGroup;
-
+ final TraceSessionGroup sessionGroup = fSessionGroup;
+
// Open dialog box for the node name and address
ICreateSessionDialog dialog = TraceControlDialogFactory.getInstance().getCreateSessionDialog();
dialog.setTraceSessionGroup(sessionGroup);
try {
sessionGroup.createSession(sessionName, sessionPath, monitor);
} catch (ExecutionException e) {
- return new Status(Status.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_CreateSessionFailure, e);
- }
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_CreateSessionFailure, e);
+ }
return Status.OK_STATUS;
}
};
*/
@Override
public boolean isEnabled() {
-
+
// Get workbench page for the Control View
IWorkbenchPage page = getWorkbenchPage();
if (page == null) {
/**********************************************************************
* 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.handlers;
* <p>
* Command handler implementation to destroy one or more trace sessions.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class DestroySessionHandler extends BaseControlViewHandler {
// Attributes
// ------------------------------------------------------------------------
/**
- * The list of session components the command is to be executed on.
+ * The list of session components the command is to be executed on.
*/
- private List<TraceSessionComponent> fSessions = new ArrayList<TraceSessionComponent>();
-
+ private final List<TraceSessionComponent> fSessions = new ArrayList<TraceSessionComponent>();
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
}
// Get user confirmation
IConfirmDialog dialog = TraceControlDialogFactory.getInstance().getConfirmDialog();
- if (!dialog.openConfirm(window.getShell(),
- Messages.TraceControl_DestroyConfirmationTitle,
+ if (!dialog.openConfirm(window.getShell(),
+ Messages.TraceControl_DestroyConfirmationTitle,
Messages.TraceControl_DestroyConfirmationMessage)) {
return null;
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
- // Make a copy of the list of sessions to avoid ConcurrentModificationException when iterating
- // over fSessions, since fSessions is modified in another thread triggered by the tree viewer refresh
+ // Make a copy of the list of sessions to avoid ConcurrentModificationException when iterating
+ // over fSessions, since fSessions is modified in another thread triggered by the tree viewer refresh
// after removing a session.
- TraceSessionComponent[] sessions = (TraceSessionComponent[])fSessions.toArray(new TraceSessionComponent[fSessions.size()]);
+ TraceSessionComponent[] sessions = fSessions.toArray(new TraceSessionComponent[fSessions.size()]);
for (int i = 0; i < sessions.length; i++) {
// Destroy all selected sessions
sessionGroup.destroySession(session, monitor);
}
} catch (ExecutionException e) {
- return new Status(Status.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_DestroySessionFailure, e);
- }
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_DestroySessionFailure, e);
+ }
return Status.OK_STATUS;
}
};
if (selection instanceof StructuredSelection) {
StructuredSelection structered = ((StructuredSelection) selection);
for (Iterator<?> iterator = structered.iterator(); iterator.hasNext();) {
- Object element = (Object) iterator.next();
+ Object element = iterator.next();
if (element instanceof TraceSessionComponent) {
// Add only TraceSessionComponents that are inactive and not destroyed
TraceSessionComponent session = (TraceSessionComponent) element;
/**********************************************************************
* 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.handlers;
* <p>
* Command handler implementation to enable a trace channel for known domain.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class EnableChannelOnDomainHandler extends BaseEnableChannelHandler {
((DomainCommandParameter)param).getDomain().enableChannels(channelNames, info, monitor);
}
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.BaseCreateChannelHandler#getDomain(org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.CommandParameter)
*/
@Override
public boolean isEnabled() {
-
+
// Get workbench page for the Control View
IWorkbenchPage page = getWorkbenchPage();
if (page == null) {
return false;
}
-
+
TraceDomainComponent domain = null;
TraceSessionComponent session = null;
-
+
// Check if one domain is selected
ISelection selection = page.getSelection(ControlView.ID);
if (selection instanceof StructuredSelection) {
StructuredSelection structered = ((StructuredSelection) selection);
for (Iterator<?> iterator = structered.iterator(); iterator.hasNext();) {
- Object element = (Object) iterator.next();
+ Object element = iterator.next();
if (element instanceof TraceDomainComponent) {
TraceDomainComponent tmpDomain = (TraceDomainComponent) element;
session = (TraceSessionComponent) tmpDomain.getParent();
-
+
// Add only TraceDomainComponent whose TraceSessionComponent parent is inactive and not destroyed
if ((session.getSessionState() == TraceSessionState.INACTIVE) && (!session.isDestroyed())) {
domain = tmpDomain;
}
}
}
-
+
boolean isEnabled = domain != null;
-
+
fLock.lock();
try {
fParam = null;
} finally {
fLock.unlock();
}
-
+
return isEnabled;
}
-
+
}
/**********************************************************************
* 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.handlers;
/**
* <p>
- * Command handler implementation to enable a trace channel for unknown domain
+ * Command handler implementation to enable a trace channel for unknown domain
* (on session level).
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class EnableChannelOnSessionHandler extends BaseEnableChannelHandler {
public void enableChannel(CommandParameter param, List<String> channelNames, IChannelInfo info, boolean isKernel, IProgressMonitor monitor) throws ExecutionException {
param.getSession().enableChannels(channelNames, info, isKernel, monitor);
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.BaseCreateChannelHandler#getDomain(org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.CommandParameter)
if (selection instanceof StructuredSelection) {
StructuredSelection structered = ((StructuredSelection) selection);
for (Iterator<?> iterator = structered.iterator(); iterator.hasNext();) {
- Object element = (Object) iterator.next();
+ Object element = iterator.next();
if (element instanceof TraceSessionComponent) {
// Add only TraceSessionComponents that are inactive and not destroyed
TraceSessionComponent tmpSession = (TraceSessionComponent) element;
}
}
boolean isEnabled = session != null;
-
+
fLock.lock();
try {
fParam = null;
} finally {
fLock.unlock();
}
-
+
return isEnabled;
}
}
/**********************************************************************
* 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.handlers;
* <p>
* Command handler implementation to enable events for a known channel.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class EnableEventOnChannelHandler extends BaseEnableEventHandler {
public TraceDomainComponent getDomain(CommandParameter param) {
if (param instanceof ChannelCommandParameter) {
return (TraceDomainComponent) ((ChannelCommandParameter)param).getChannel().getParent();
- }
+ }
return null;
}
if (selection instanceof StructuredSelection) {
StructuredSelection structered = ((StructuredSelection) selection);
for (Iterator<?> iterator = structered.iterator(); iterator.hasNext();) {
- Object element = (Object) iterator.next();
+ Object element = iterator.next();
if (element instanceof TraceChannelComponent) {
// Add only if corresponding TraceSessionComponents is inactive and not destroyed
- TraceChannelComponent tmpChannel = (TraceChannelComponent) element;
+ TraceChannelComponent tmpChannel = (TraceChannelComponent) element;
session = tmpChannel.getSession();
if(!session.isDestroyed()) {
channel = tmpChannel;
}
}
}
-
+
boolean isEnabled = (channel != null);
fLock.lock();
try {
/**********************************************************************
* 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.handlers;
* Command handler implementation to enable events for a known domain and default channel 'channel0'
* (which will be created if doesn't exist).
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class EnableEventOnDomainHandler extends BaseEnableEventHandler {
if (selection instanceof StructuredSelection) {
StructuredSelection structered = ((StructuredSelection) selection);
for (Iterator<?> iterator = structered.iterator(); iterator.hasNext();) {
- Object element = (Object) iterator.next();
+ Object element = iterator.next();
if (element instanceof TraceDomainComponent) {
// Add only if corresponding TraceSessionComponents is inactive and not destroyed
- TraceDomainComponent tmpDomain = (TraceDomainComponent) element;
+ TraceDomainComponent tmpDomain = (TraceDomainComponent) element;
session = tmpDomain.getSession();
if(session.getSessionState() == TraceSessionState.INACTIVE && !session.isDestroyed()) {
domain = tmpDomain;
}
}
}
-
+
boolean isEnabled = (domain != null);
fLock.lock();
try {
/**********************************************************************
* 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.handlers;
* Command handler implementation to enable events for a known session and default channel 'channel0'
* (which will be created if doesn't exist).
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class EnableEventOnSessionHandler extends BaseEnableEventHandler {
// ------------------------------------------------------------------------
// Attributes
// ------------------------------------------------------------------------
-
+
//-------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
param.getSession().enableLogLevel(eventName, logLevelType, level, monitor);
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.BaseEnableEventHandler#getDomain(org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.CommandParameter)
if (selection instanceof StructuredSelection) {
StructuredSelection structered = ((StructuredSelection) selection);
for (Iterator<?> iterator = structered.iterator(); iterator.hasNext();) {
- Object element = (Object) iterator.next();
+ Object element = iterator.next();
if (element instanceof TraceSessionComponent) {
// Add only if corresponding TraceSessionComponents is inactive and not destroyed
- TraceSessionComponent tmpSession = (TraceSessionComponent) element;
+ TraceSessionComponent tmpSession = (TraceSessionComponent) element;
if(tmpSession.getSessionState() == TraceSessionState.INACTIVE && !tmpSession.isDestroyed()) {
session = tmpSession;
}
/**********************************************************************
* 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.handlers;
* <p>
* Command handler implementation to import traces from a (remote) session to a tracing project.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class ImportHandler extends BaseControlViewHandler {
// Attributes
// ------------------------------------------------------------------------
protected CommandParameter fParam;
-
+
// ------------------------------------------------------------------------
// Accessors
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
-
+
/*
* (non-Javadoc)
* @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
fLock.lock();
try {
final CommandParameter param = fParam.clone();
-
+
final IImportDialog dialog = TraceControlDialogFactory.getInstance().getImportDialog();
dialog.setSession(param.getSession());
try {
List<ImportFileInfo> traces = dialog.getTracePathes();
IProject project = dialog.getProject();
-
+
for (Iterator<ImportFileInfo> iterator = traces.iterator(); iterator.hasNext();) {
- ImportFileInfo remoteFile = (ImportFileInfo) iterator.next();
+ ImportFileInfo remoteFile = iterator.next();
downloadTrace(remoteFile, project);
}
} catch (ExecutionException e) {
- return new Status(Status.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_ImportFailure, e);
- }
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_ImportFailure, e);
+ }
return Status.OK_STATUS;
}
};
if (selection instanceof StructuredSelection) {
StructuredSelection structered = ((StructuredSelection) selection);
for (Iterator<?> iterator = structered.iterator(); iterator.hasNext();) {
- Object element = (Object) iterator.next();
+ Object element = iterator.next();
if (element instanceof TraceSessionComponent) {
// Add only TraceSessionComponents that are inactive and not destroyed
TraceSessionComponent tmpSession = (TraceSessionComponent) element;
}
return isEnabled;
}
-
+
// ------------------------------------------------------------------------
// Helper methods
// ------------------------------------------------------------------------
/**
* Downloads a trace from the remote host to the given project.
- * @param trace - trace information of trace to import
- * @param project - project to import to
+ *
+ * @param trace
+ * - trace information of trace to import
+ * @param project
+ * - project to import to
* @throws ExecutionException
*/
private void downloadTrace(ImportFileInfo trace, IProject project) throws ExecutionException {
try {
IRemoteFileSubSystem fsss = trace.getImportFile().getParentRemoteFileSubSystem();
-
+
IFolder traceFolder = project.getFolder(TmfTraceFolder.TRACE_FOLDER_NAME);
if (!traceFolder.exists()) {
throw new ExecutionException(Messages.TraceControl_ImportDialogInvalidTracingProject + " (" + TmfTraceFolder.TRACE_FOLDER_NAME + ")"); //$NON-NLS-1$//$NON-NLS-2$
destinations[i] = folder.getLocation().addTrailingSeparator().append(sources[i].getName()).toString();
encodings[i] = null;
}
-
+
fsss.downloadMultiple(sources, destinations, encodings, new NullProgressMonitor());
-
+
} catch (SystemMessageException e) {
throw new ExecutionException(e.toString(), e);
} catch (CoreException e) {
/**********************************************************************
* 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.handlers;
* <p>
* Command handler implementation to refresh node configuration.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class RefreshHandler extends BaseControlViewHandler {
* The node component reference.
*/
private TargetNodeComponent fNode;
-
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
// Check if one or more session are selected
ISelection selection = page.getSelection(ControlView.ID);
if (selection instanceof StructuredSelection) {
-
+
StructuredSelection structered = ((StructuredSelection) selection);
for (Iterator<?> iterator = structered.iterator(); iterator.hasNext();) {
- Object element = (Object) iterator.next();
+ Object element = iterator.next();
if (element instanceof TraceControlComponent) {
TraceControlComponent component = (TraceControlComponent) element;
boolean isConnected = component.getTargetNodeState() == TargetNodeState.CONNECTED;
}
}
}
-
+
boolean isEnabled = node != null;
-
+
fLock.lock();
try {
fNode = null;
} finally {
fLock.unlock();
}
-
+
return isEnabled;
}
}
/*******************************************************************************
* 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.internal.lttng2.ui.views.control.messages;
/**
* <p>
- * Messages file for the trace control package.
+ * Messages file for the trace control package.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
+@SuppressWarnings("javadoc")
final public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.lttng2.ui.views.control.messages.messages"; //$NON-NLS-1$
-
+
// Failures
public static String TraceControl_ConnectionFailure;
public static String TraceControl_DisconnectionFailure;
public static String TraceControl_UnexpectedCommandOutputFormat;
public static String TraceControl_UnexpectedNameError;
public static String TraceControl_UnexpectedPathError;
-
+
public static String TraceControl_UnsupportedVersionError;
public static String TraceControl_GettingVersionError;
-
+
// Commands
public static String TraceControl_RetrieveNodeConfigurationJob;
public static String TraceControl_ListSessionFailure;
public static String TraceControl_NewNodeCreationFailure;
public static String TraceControl_CreateSessionJob;
public static String TraceControl_CreateSessionFailure;
-
+
public static String TraceControl_DestroySessionJob;
public static String TraceControl_DestroySessionFailure;
public static String TraceControl_DestroyConfirmationTitle;
public static String TraceControl_DestroyConfirmationMessage;
-
+
public static String TraceControl_ImportJob;
public static String TraceControl_ImportFailure;
public static String TraceControl_CreateChannelStateJob;
public static String TraceControl_CreateChannelStateFailure;
-
+
public static String TraceControl_ChangeChannelStateJob;
public static String TraceControl_ChangeChannelStateFailure;
public static String TraceControl_ChangeEventStateJob;
public static String TraceControl_ChangeEventStateFailure;
-
+
public static String TraceControl_EnableEventsJob;
public static String TraceControl_EnableEventsFailure;
public static String TraceControl_DisableEventsJob;
-
+
public static String TraceControl_GetContextJob;
public static String TraceControl_GetContextFailure;
-
+
public static String TraceControl_AddContextJob;
public static String TraceControl_AddContextFailure;
-
+
public static String TraceControl_AddCalibrateJob;
public static String TraceControl_AddCalibrateFailure;
-
+
// Dialogs
public static String TraceControl_NewDialogTitle;
public static String TraceControl_NewNodeExistingConnectionGroupName;
public static String TraceControl_NewNodeHostNameLabel;
public static String TraceControl_NewNodeHostNameTooltip;
public static String TraceControl_AlreadyExistsError;
-
+
public static String TraceControl_CreateSessionDialogTitle;
public static String TraceControl_CreateSessionNameLabel;
public static String TraceControl_CreateSessionNameTooltip;
public static String TraceControl_SessionPathAlreadyExistsError;
public static String TraceControl_InvalidSessionPathError;
public static String TraceControl_FileSubSystemError;
-
+
public static String TraceControl_EnableChannelDialogTitle;
public static String TraceControl_EnableChannelNameLabel;
public static String TraceControl_EnableChannelNameTooltip;
public static String TraceControl_EnableChannelDiscardModeTooltip;
public static String TraceControl_EnableChannelOverwriteModeLabel;
public static String TraceControl_EnableChannelOverwriteModeTooltip;
-
+
public static String TraceControl_InvalidChannelNameError;
public static String TraceControl_ChannelAlreadyExistsError;
-
+
public static String TraceControl_EnableEventsDialogTitle;
public static String TraceControl_EnableEventsSessionGroupName;
public static String TraceControl_EnableEventsChannelGroupName;
public static String TraceControl_EnableEventsFucntionGroupName;
public static String TraceControl_EnableEventsFunctionEventNameTooltip;
public static String TraceControl_EnableEventsFunctionNameLabel;
-
+
public static String TraceControl_EnableEventsWildcardGroupName;
public static String TraceControl_EnableEventsWildcardLabel;
public static String TraceControl_EnableEventsWildcardTooltip;
public static String TraceControl_InvalidWildcardError;
public static String TraceControl_InvalidLogLevelEventNameError;
public static String TraceControl_InvalidLogLevel;
-
+
public static String TraceControl_AddContextDialogTitle;
public static String TraceControl_AddContextAvailableContextsLabel;
public static String TraceControl_AddContextAvailableContextsTooltip;
public static String TraceControl_AddContextAllLabel;
-
+
public static String TraceControl_ImportDialogTitle;
public static String TraceControl_ImportDialogTracesGroupName;
public static String TraceControl_ImportDialogTracesTooltip;
public static String TraceControl_ImportDialogConfirmationNewNameLabel;
public static String TraceControl_InvalidTraceNameError;
public static String TraceControl_ImportDialogTraceAlreadyExistError;
-
+
// Tree structure strings
public static String TraceControl_KernelDomainDisplayName;
public static String TraceControl_UstDisplayName;
public static String TraceControl_EventDisplayName;
public static String TraceControl_ProviderDisplayName;
public static String TraceControl_KernelProviderDisplayName;
-
+
// Property names
public static String TraceControl_SessionNamePropertyName;
public static String TraceControl_EventNamePropertyName;
public static String TraceControl_ProbeAddressPropertyName;
public static String TraceControl_ProbeOffsetPropertyName;
public static String TraceControl_ProbeSymbolPropertyName;
-
+
// Preferences
public static String TraceControl_TracingGroupPreference;
public static String TraceControl_LoggingPreference;
public static String TraceControl_LogfilePath;
public static String TraceControl_AppendLogfilePreference;
-
+
public static String TraceControl_VerboseLevelsPreference;
public static String TraceControl_VerboseLevelNonePreference;
public static String TraceControl_VerboseLevelVerbosePreference;
public static String TraceControl_VerboseLevelVeryVerbosePreference;
public static String TraceControl_VerboseLevelVeryVeryVerbosePreference;
-
+
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
/**********************************************************************
* 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
**********************************************************************/
* <p>
* Implementation of the Kernel provider component.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class KernelProviderComponent extends TraceControlComponent {
-
+
// ------------------------------------------------------------------------
// Constants
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
// Attributes
// ------------------------------------------------------------------------
-
+
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
/**
- * Constructor
+ * Constructor
* @param name - the name of the component.
* @param parent - the parent of this component.
*/
setToolTip(Messages.TraceControl_ProviderDisplayName);
setImage(KERNEL_PROVIDER_ICON_FILE);
}
-
+
// ------------------------------------------------------------------------
// Accessors
// ------------------------------------------------------------------------
/**
- * Sets the events information for this component.
- * @param eventInfos - events information to set.
+ * Sets the events information for this component.
+ * @param eventInfos - events information to set.
*/
public void setEventInfo(List<IBaseEventInfo> eventInfos) {
for (Iterator<IBaseEventInfo> iterator = eventInfos.iterator(); iterator.hasNext();) {
- IBaseEventInfo baseEventInfo = (IBaseEventInfo) iterator.next();
+ IBaseEventInfo baseEventInfo = iterator.next();
BaseEventComponent component = new BaseEventComponent(baseEventInfo.getName(), this);
component.setEventInfo(baseEventInfo);
addChild(component);
return new KernelProviderPropertySource(this);
}
return null;
- }
+ }
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
-
+
}
/**********************************************************************
* 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.model.impl;
* <p>
* Implementation of the trace node component.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class TargetNodeComponent extends TraceControlComponent implements ICommunicationsListener {
// Constructors
// ------------------------------------------------------------------------
/**
- * Constructor
+ * Constructor
* @param name - the name of the component
* @param parent - the parent of the component
* @param host - the host connection implementation
}
/**
- * Constructor (using default proxy)
+ * Constructor (using default proxy)
* @param name - the name of the component
* @param parent - the parent of the component
* @param host - the host connection implementation
}
return fDisconnectedImage;
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceControlComponent#getTargetNodeState()
public TargetNodeState getTargetNodeState() {
return fState;
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceControlComponent#setTargetNodeState(org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponent.TargetNodeState)
fState = state;
fireComponentChanged(TargetNodeComponent.this);
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceControlComponent#getControlService()
*/
@Override
public void setControlService(ILttngControlService service) {
- fService = (ILttngControlService)service;
+ fService = service;
}
/*
return new TargetNodePropertySource(this);
}
return null;
- }
-
+ }
+
/**
* @return remote host name
*/
public TraceSessionComponent[] getSessions() {
List<ITraceControlComponent> compenents = getChildren(TraceSessionGroup.class);
if (compenents.size() > 0) {
- TraceSessionGroup group = (TraceSessionGroup)compenents.get(0);
+ TraceSessionGroup group = (TraceSessionGroup)compenents.get(0);
List<ITraceControlComponent> sessions = group.getChildren(TraceSessionComponent.class);
- return (TraceSessionComponent[])sessions.toArray(new TraceSessionComponent[sessions.size()]);
+ return sessions.toArray(new TraceSessionComponent[sessions.size()]);
}
return new TraceSessionComponent[0];
}
-
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
-
+
/*
* @see org.eclipse.rse.core.subsystems.ICommunicationsListener#communicationsStateChange(org.eclipse.rse.core.subsystems.CommunicationsEvent)
*/
} catch (Exception e) {
Activator.getDefault().logError(Messages.TraceControl_DisconnectionFailure + " (" + getName() + "). \n", e); //$NON-NLS-1$ //$NON-NLS-2$
} finally {
- handleDisconnected();
+ handleDisconnected();
}
}
}
/**
- * Retrieves the trace configuration from the target node and populates the information
- * in the tree model. The execution is done in a own job.
- *
- * @throws ExecutionException
+ * Retrieves the trace configuration from the target node and populates the
+ * information in the tree model. The execution is done in a own job.
*/
public void getConfigurationFromNode() {
Job job = new Job(Messages.TraceControl_RetrieveNodeConfigurationJob) {
TraceProviderGroup providerGroup = new TraceProviderGroup(Messages.TraceControl_ProviderDisplayName, TargetNodeComponent.this);
addChild(providerGroup);
providerGroup.getProviderFromNode(monitor);
-
+
// Get session information from node
TraceSessionGroup sessionGroup = new TraceSessionGroup(Messages.TraceControl_AllSessionsDisplayName, TargetNodeComponent.this);
addChild(sessionGroup);
sessionGroup.getSessionsFromNode(monitor);
} catch (ExecutionException e) {
removeAllChildren();
- return new Status(Status.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_ListSessionFailure, e);
- }
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_ListSessionFailure, e);
+ }
return Status.OK_STATUS;
}
removeAllChildren();
getConfigurationFromNode();
}
-
+
/**
* Deregisters host from registry.
*/
}
/**
- * Handles the connected event.
+ * Handles the connected event.
*/
private void handleConnected() {
setTargetNodeState(TargetNodeState.CONNECTED);
}
/**
- * Handles the disconnected event.
+ * Handles the disconnected event.
*/
private void handleDisconnected() {
removeAllChildren();
/**********************************************************************
* 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.model.impl;
* <p>
* Implementation of the trace channel component.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class TraceChannelComponent extends TraceControlComponent {
* Path to icon file for this component (state disabled).
*/
public static final String TRACE_CHANNEL_ICON_FILE_DISABLED = "icons/obj16/channel_disabled.gif"; //$NON-NLS-1$
-
+
// ------------------------------------------------------------------------
// Attributes
// ------------------------------------------------------------------------
* The image to be displayed in disabled state.
*/
private Image fDisabledImage = null;
-
+
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
/**
- * Constructor
+ * Constructor
* @param name - the name of the component.
* @param parent - the parent of this component.
*/
fChannelInfo = new ChannelInfo(name);
fDisabledImage = Activator.getDefault().loadIcon(TRACE_CHANNEL_ICON_FILE_DISABLED);
}
-
+
// ------------------------------------------------------------------------
// Accessors
// ------------------------------------------------------------------------
/**
* Sets the channel information.
+ *
* @param channelInfo
+ * The channel info to assign to this component
*/
public void setChannelInfo(IChannelInfo channelInfo) {
fChannelInfo = channelInfo;
* @return the read timer interval.
*/
public long getReadTimer() {
- return fChannelInfo.getReadTimer();
+ return fChannelInfo.getReadTimer();
}
/**
* Sets the read timer interval to the given value.
return new TraceChannelPropertySource(this);
}
return null;
- }
+ }
/**
* @return session name from parent
*/
public String getSessionName() {
- return ((TraceDomainComponent)getParent()).getSessionName();
+ return ((TraceDomainComponent)getParent()).getSessionName();
}
/**
* @return session from parent
*/
public TraceSessionComponent getSession() {
- return ((TraceDomainComponent)getParent()).getSession();
+ return ((TraceDomainComponent)getParent()).getSession();
}
/**
public boolean isKernel() {
return ((TraceDomainComponent)getParent()).isKernel();
}
-
+
/**
* @return the parent target node
*/
public TargetNodeComponent getTargetNode() {
return ((TraceDomainComponent)getParent()).getTargetNode();
}
-
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
/**
* Enables a list of events with no additional parameters.
- * @param eventNames - a list of event names to enabled.
+ *
+ * @param eventNames
+ * - a list of event names to enabled.
* @throws ExecutionException
+ * If the command fails
*/
public void enableEvents(List<String> eventNames) throws ExecutionException {
enableEvents(eventNames, new NullProgressMonitor());
/**
* Enables a list of events with no additional parameters.
- * @param eventNames - a list of event names to enabled.
- * @param monitor - a progress monitor
+ *
+ * @param eventNames
+ * - a list of event names to enabled.
+ * @param monitor
+ * - a progress monitor
* @throws ExecutionException
+ * If the command fails
*/
public void enableEvents(List<String> eventNames, IProgressMonitor monitor) throws ExecutionException {
getControlService().enableEvents(getSessionName(), getName(), eventNames, isKernel(), monitor);
}
-
+
/**
* Enables all syscalls (for kernel domain)
+ *
* @throws ExecutionException
+ * If the command fails
*/
public void enableSyscalls() throws ExecutionException {
enableSyscalls(new NullProgressMonitor());
/**
* Enables all syscalls (for kernel domain)
- * @param monitor - a progress monitor
+ *
+ * @param monitor
+ * - a progress monitor
* @throws ExecutionException
+ * If the command fails
*/
public void enableSyscalls(IProgressMonitor monitor) throws ExecutionException {
getControlService().enableSyscalls(getSessionName(), getName(), monitor);
/**
* Enables a dynamic probe (for kernel domain)
- * @param eventName - event name for probe
- * @param isFunction - true for dynamic function entry/return probe else false
- * @param probe - the actual probe
+ *
+ * @param eventName
+ * - event name for probe
+ * @param isFunction
+ * - true for dynamic function entry/return probe else false
+ * @param probe
+ * - the actual probe
* @throws ExecutionException
+ * If the command fails
*/
- public void enableProbe(String eventName, boolean isFunction, String probe) throws ExecutionException {
+ public void enableProbe(String eventName, boolean isFunction, String probe)
+ throws ExecutionException {
enableProbe(eventName, isFunction, probe, new NullProgressMonitor());
}
/**
* Enables a dynamic probe (for kernel domain)
- * @param eventName - event name for probe
- * @param isFunction - true for dynamic function entry/return probe else false
- * @param probe - the actual probe
- * @param monitor - a progress monitor
+ *
+ * @param eventName
+ * - event name for probe
+ * @param isFunction
+ * - true for dynamic function entry/return probe else false
+ * @param probe
+ * - the actual probe
+ * @param monitor
+ * - a progress monitor
* @throws ExecutionException
+ * If the command fails
*/
- public void enableProbe(String eventName, boolean isFunction, String probe, IProgressMonitor monitor) throws ExecutionException {
+ public void enableProbe(String eventName, boolean isFunction, String probe,
+ IProgressMonitor monitor) throws ExecutionException {
getControlService().enableProbe(getSessionName(), getName(), eventName, isFunction, probe, monitor);
}
/**
* Enables events using log level.
- * @param eventName - a event name
- * @param logLevelType - a log level type
- * @param level - a log level
+ *
+ * @param eventName
+ * - a event name
+ * @param logLevelType
+ * - a log level type
+ * @param level
+ * - a log level
* @throws ExecutionException
+ * If the command fails
*/
- public void enableLogLevel(String eventName, LogLevelType logLevelType, TraceLogLevel level) throws ExecutionException {
+ public void enableLogLevel(String eventName, LogLevelType logLevelType,
+ TraceLogLevel level) throws ExecutionException {
enableLogLevel(eventName, logLevelType, level, new NullProgressMonitor());
}
/**
* Enables events using log level.
- * @param eventName - a event name
- * @param logLevelType - a log level type
- * @param level - a log level
- * @param monitor - a progress monitor
+ *
+ * @param eventName
+ * - a event name
+ * @param logLevelType
+ * - a log level type
+ * @param level
+ * - a log level
+ * @param monitor
+ * - a progress monitor
* @throws ExecutionException
+ * If the command fails
*/
- public void enableLogLevel(String eventName, LogLevelType logLevelType, TraceLogLevel level, IProgressMonitor monitor) throws ExecutionException {
+ public void enableLogLevel(String eventName, LogLevelType logLevelType,
+ TraceLogLevel level, IProgressMonitor monitor)
+ throws ExecutionException {
getControlService().enableLogLevel(getSessionName(), getName(), eventName, logLevelType, level, monitor);
}
/**
* Enables a list of events with no additional parameters.
- * @param eventNames - a list of event names to enabled.
+ *
+ * @param eventNames
+ * - a list of event names to enabled.
* @throws ExecutionException
+ * If the command fails
*/
public void disableEvent(List<String> eventNames) throws ExecutionException {
disableEvent(eventNames, new NullProgressMonitor());
/**
* Enables a list of events with no additional parameters.
- * @param eventNames - a list of event names to enabled.
- * @param monitor - a progress monitor
+ *
+ * @param eventNames
+ * - a list of event names to enabled.
+ * @param monitor
+ * - a progress monitor
* @throws ExecutionException
+ * If the command fails
*/
- public void disableEvent(List<String> eventNames, IProgressMonitor monitor) throws ExecutionException {
- getControlService().disableEvent(getParent().getParent().getName(), getName(), eventNames, isKernel(), monitor);
+ public void disableEvent(List<String> eventNames, IProgressMonitor monitor)
+ throws ExecutionException {
+ getControlService().disableEvent(getParent().getParent().getName(),
+ getName(), eventNames, isKernel(), monitor);
}
-
+
/**
* Add contexts to given channels and or events
- * @param contexts - a list of contexts to add
+ *
+ * @param contexts
+ * - a list of contexts to add
* @throws ExecutionException
+ * If the command fails
*/
public void addContexts(List<String> contexts) throws ExecutionException {
addContexts(contexts, new NullProgressMonitor());
/**
* Add contexts to given channels and or events
- * @param contexts - a list of contexts to add
- * @param monitor - a progress monitor
+ *
+ * @param contexts
+ * - a list of contexts to add
+ * @param monitor
+ * - a progress monitor
* @throws ExecutionException
+ * If the command fails
*/
- public void addContexts(List<String> contexts, IProgressMonitor monitor) throws ExecutionException {
- getControlService().addContexts(getSessionName(), getName(), null, isKernel(), contexts, monitor);
+ public void addContexts(List<String> contexts, IProgressMonitor monitor)
+ throws ExecutionException {
+ getControlService().addContexts(getSessionName(), getName(), null,
+ isKernel(), contexts, monitor);
}
}
/**********************************************************************
* 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.model.impl;
* <p>
* Base implementation for trace control component.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class TraceControlComponent implements ITraceControlComponent {
/**
* The list if children components.
*/
- private List<ITraceControlComponent> fChildren = new ArrayList<ITraceControlComponent>();
+ private final List<ITraceControlComponent> fChildren = new ArrayList<ITraceControlComponent>();
/**
* The list of listeners to be notified about changes.
*/
- private ListenerList fListeners = new ListenerList();
+ private final ListenerList fListeners = new ListenerList();
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
-
+
/**
* Constructor
* @param name - the name of the component.
public TraceControlComponent(String name) {
this(name, null);
}
-
+
/**
* Constructor
* @param name - the name of the component.
fName = name;
fParent = parent;
}
-
+
// ------------------------------------------------------------------------
// Accessors
// ------------------------------------------------------------------------
*/
@Override
public Image getImage() {
- return fImage;
+ return fImage;
}
/*
public void setImage(Image image) {
fImage = image;
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponent#getToolTip()
public void setToolTip(String toolTip) {
fToolTip = toolTip;
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponent#getTargetNodeState()
*/
- @Override
+ @Override
public TargetNodeState getTargetNodeState() {
if (getParent() != null) {
return getParent().getTargetNodeState();
}
return TargetNodeState.DISCONNECTED;
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponent#setTargetNodeState(org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponent.TargetNodeState)
*/
@Override
public ITraceControlComponent[] getChildren() {
- return (ITraceControlComponent [])fChildren.toArray(new ITraceControlComponent[fChildren.size()]);
+ return fChildren.toArray(new ITraceControlComponent[fChildren.size()]);
}
/*
@Override
public void setChildren(List<ITraceControlComponent> children) {
for (Iterator<ITraceControlComponent> iterator = children.iterator(); iterator.hasNext();) {
- ITraceControlComponent traceControlComponent = (ITraceControlComponent) iterator.next();
+ ITraceControlComponent traceControlComponent = iterator.next();
fChildren.add(traceControlComponent);
fireComponentChanged(this);
}
List<ITraceControlComponent> list = new ArrayList<ITraceControlComponent>();
for (Iterator<ITraceControlComponent> iterator = fChildren.iterator(); iterator.hasNext();) {
- ITraceControlComponent child = (ITraceControlComponent) iterator.next();
+ ITraceControlComponent child = iterator.next();
if (child.getClass() == clazz) {
list.add(child);
}
@Override
public void removeAllChildren() {
for (Iterator<ITraceControlComponent> iterator = fChildren.iterator(); iterator.hasNext();) {
- ITraceControlComponent child = (ITraceControlComponent) iterator.next();
+ ITraceControlComponent child = iterator.next();
child.removeAllChildren();
}
fChildren.clear();
*/
@Override
public void addComponentListener(ITraceControlComponentChangedListener listener) {
- if (fParent != null)
+ if (fParent != null) {
fParent.addComponentListener(listener);
- else {
+ } else {
fListeners.add(listener);
}
}
*/
@Override
public void removeComponentListener(ITraceControlComponentChangedListener listener) {
- if (fParent != null)
+ if (fParent != null) {
fParent.removeComponentListener(listener);
- else {
+ } else {
fListeners.remove(listener);
}
}
}
}
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponent#fireCompenentChanged(org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponent)
/**********************************************************************
* 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.model.impl;
* <p>
* Implementation of the trace domain component.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class TraceDomainComponent extends TraceControlComponent {
// Constructors
// ------------------------------------------------------------------------
/**
- * Constructor
+ * Constructor
* @param name - the name of the component.
* @param parent - the parent of this component.
*/
}
return null;
}
-
+
/**
* @return session name from parent
*/
public String getSessionName() {
return ((TraceSessionComponent)getParent()).getName();
}
-
+
/**
* @return session from parent
*/
public TraceSessionComponent getSession() {
- return (TraceSessionComponent)getParent();
+ return (TraceSessionComponent)getParent();
}
/**
public boolean isKernel() {
return fDomainInfo.isKernel();
}
-
+
/**
- * Sets whether domain is Kernel domain or UST
+ * Sets whether domain is Kernel domain or UST
* @param isKernel true for kernel, false for UST
*/
public void setIsKernel(boolean isKernel) {
fDomainInfo.setIsKernel(isKernel);
}
-
+
/**
* @return returns all available channels for this domain.
*/
public TraceChannelComponent[] getChannels() {
List<ITraceControlComponent> channels = getChildren(TraceChannelComponent.class);
- return (TraceChannelComponent[])channels.toArray(new TraceChannelComponent[channels.size()]);
+ return channels.toArray(new TraceChannelComponent[channels.size()]);
}
-
+
/**
* @return the parent target node
*/
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
+
/**
- * Retrieves the session configuration from the node.
+ * Retrieves the session configuration from the node.
+ *
* @throws ExecutionException
+ * If the command fails
*/
public void getConfigurationFromNode() throws ExecutionException {
getConfigurationFromNode(new NullProgressMonitor());
}
+
/**
- * Retrieves the session configuration from the node.
- * @param monitor - a progress monitor
+ * Retrieves the session configuration from the node.
+ *
+ * @param monitor
+ * - a progress monitor
* @throws ExecutionException
+ * If the command fails
*/
public void getConfigurationFromNode(IProgressMonitor monitor) throws ExecutionException {
TraceSessionComponent session = (TraceSessionComponent) getParent();
session.getConfigurationFromNode(monitor);
}
+
/**
- * Enables channels with given names which are part of this domain. If a given channel
- * doesn't exists it creates a new channel with the given parameters (or default values
- * if given parameter is null).
- * @param channelNames - a list of channel names to enable on this domain
- * @param info - channel information to set for the channel (use null for default)
+ * Enables channels with given names which are part of this domain. If a
+ * given channel doesn't exists it creates a new channel with the given
+ * parameters (or default values if given parameter is null).
+ *
+ * @param channelNames
+ * - a list of channel names to enable on this domain
+ * @param info
+ * - channel information to set for the channel (use null for
+ * default)
* @throws ExecutionException
+ * If the command fails
*/
public void enableChannels(List<String> channelNames, IChannelInfo info) throws ExecutionException {
enableChannels(channelNames, info, new NullProgressMonitor());
}
+
/**
- * Enables channels with given names which are part of this domain. If a given channel
- * doesn't exists it creates a new channel with the given parameters (or default values
- * if given parameter is null).
- * @param channelNames - a list of channel names to enable on this domain
- * @param info - channel information to set for the channel (use null for default)
- * @param monitor - a progress monitor
+ * Enables channels with given names which are part of this domain. If a
+ * given channel doesn't exists it creates a new channel with the given
+ * parameters (or default values if given parameter is null).
+ *
+ * @param channelNames
+ * - a list of channel names to enable on this domain
+ * @param info
+ * - channel information to set for the channel (use null for
+ * default)
+ * @param monitor
+ * - a progress monitor
* @throws ExecutionException
+ * If the command fails
*/
- public void enableChannels(List<String> channelNames, IChannelInfo info, IProgressMonitor monitor) throws ExecutionException {
- getControlService().enableChannels(getParent().getName(), channelNames, isKernel(), info, monitor);
+ public void enableChannels(List<String> channelNames, IChannelInfo info,
+ IProgressMonitor monitor) throws ExecutionException {
+ getControlService().enableChannels(getParent().getName(), channelNames,
+ isKernel(), info, monitor);
}
+
/**
- * Disables channels with given names which are part of this domain.
- * @param channelNames - a list of channel names to enable on this domain
+ * Disables channels with given names which are part of this domain.
+ *
+ * @param channelNames
+ * - a list of channel names to enable on this domain
* @throws ExecutionException
+ * If the command fails
*/
- public void disableChannels(List<String> channelNames) throws ExecutionException {
+ public void disableChannels(List<String> channelNames)
+ throws ExecutionException {
disableChannels(channelNames, new NullProgressMonitor());
}
+
/**
- * Disables channels with given names which are part of this domain.
- * @param channelNames - a list of channel names to enable on this domain
- * @param monitor - a progress monitor
+ * Disables channels with given names which are part of this domain.
+ *
+ * @param channelNames
+ * - a list of channel names to enable on this domain
+ * @param monitor
+ * - a progress monitor
* @throws ExecutionException
+ * If the command fails
*/
- public void disableChannels(List<String> channelNames, IProgressMonitor monitor) throws ExecutionException {
- getControlService().disableChannels(getParent().getName(), channelNames, isKernel(), monitor);
+ public void disableChannels(List<String> channelNames,
+ IProgressMonitor monitor) throws ExecutionException {
+ getControlService().disableChannels(getParent().getName(),
+ channelNames, isKernel(), monitor);
}
/**
* Enables a list of events with no additional parameters.
- * @param eventNames - a list of event names to enabled.
- * @param monitor - a progress monitor
+ *
+ * @param eventNames
+ * - a list of event names to enabled.
+ * @param monitor
+ * - a progress monitor
* @throws ExecutionException
+ * If the command fails
*/
- public void enableEvents(List<String> eventNames, IProgressMonitor monitor) throws ExecutionException {
- getControlService().enableEvents(getSessionName(), null, eventNames, isKernel(), monitor);
+ public void enableEvents(List<String> eventNames, IProgressMonitor monitor)
+ throws ExecutionException {
+ getControlService().enableEvents(getSessionName(), null, eventNames,
+ isKernel(), monitor);
}
/**
* Enables all syscalls (for kernel domain)
+ *
* @throws ExecutionException
+ * If the command fails
*/
- public void enableSyscalls() throws ExecutionException {
+ public void enableSyscalls() throws ExecutionException {
enableSyscalls(new NullProgressMonitor());
}
- /**
- * Enables all syscalls (for kernel domain)
- * @param monitor - a progress monitor
- * @throws ExecutionException
- */
+ /**
+ * Enables all syscalls (for kernel domain)
+ *
+ * @param monitor
+ * - a progress monitor
+ * @throws ExecutionException
+ * If the command fails
+ */
- public void enableSyscalls(IProgressMonitor monitor) throws ExecutionException {
+ public void enableSyscalls(IProgressMonitor monitor)
+ throws ExecutionException {
getControlService().enableSyscalls(getSessionName(), null, monitor);
}
/**
* Enables a dynamic probe (for kernel domain)
- * @param eventName - event name for probe
- * @param isFunction - true for dynamic function entry/return probe else false
- * @param probe - the actual probe
+ *
+ * @param eventName
+ * - event name for probe
+ * @param isFunction
+ * - true for dynamic function entry/return probe else false
+ * @param probe
+ * - the actual probe
* @throws ExecutionException
+ * If the command fails
*/
- public void enableProbe(String eventName, boolean isFunction, String probe) throws ExecutionException {
+ public void enableProbe(String eventName, boolean isFunction, String probe)
+ throws ExecutionException {
enableProbe(eventName, isFunction, probe, new NullProgressMonitor());
}
-
+
/**
* Enables a dynamic probe (for kernel domain)
- * @param eventName - event name for probe
- * @param isFunction - true for dynamic function entry/return probe else false
- * @param probe - the actual probe
- * @param monitor - a progress monitor
+ *
+ * @param eventName
+ * - event name for probe
+ * @param isFunction
+ * - true for dynamic function entry/return probe else false
+ * @param probe
+ * - the actual probe
+ * @param monitor
+ * - a progress monitor
* @throws ExecutionException
+ * If the command fails
*/
- public void enableProbe(String eventName, boolean isFunction, String probe, IProgressMonitor monitor) throws ExecutionException {
- getControlService().enableProbe(getSessionName(), null, eventName, isFunction, probe, monitor);
+ public void enableProbe(String eventName, boolean isFunction, String probe,
+ IProgressMonitor monitor) throws ExecutionException {
+ getControlService().enableProbe(getSessionName(), null, eventName,
+ isFunction, probe, monitor);
}
/**
* Enables events using log level.
- * @param eventName - a event name
- * @param logLevelType - a log level type
- * @param level - a log level
+ *
+ * @param eventName
+ * - a event name
+ * @param logLevelType
+ * - a log level type
+ * @param level
+ * - a log level
* @throws ExecutionException
+ * If the command fails
*/
- public void enableLogLevel(String eventName, LogLevelType logLevelType, TraceLogLevel level) throws ExecutionException {
- enableLogLevel(eventName, logLevelType, level, new NullProgressMonitor());
+ public void enableLogLevel(String eventName, LogLevelType logLevelType,
+ TraceLogLevel level) throws ExecutionException {
+ enableLogLevel(eventName, logLevelType, level,
+ new NullProgressMonitor());
}
/**
* Enables events using log level.
- * @param eventName - a event name
- * @param logLevelType - a log level type
- * @param level - a log level
- * @param monitor - a progress monitor
+ *
+ * @param eventName
+ * - a event name
+ * @param logLevelType
+ * - a log level type
+ * @param level
+ * - a log level
+ * @param monitor
+ * - a progress monitor
* @throws ExecutionException
+ * If the command fails
*/
- public void enableLogLevel(String eventName, LogLevelType logLevelType, TraceLogLevel level, IProgressMonitor monitor) throws ExecutionException {
- getControlService().enableLogLevel(getSessionName(), null, eventName, logLevelType, level, monitor);
+ public void enableLogLevel(String eventName, LogLevelType logLevelType,
+ TraceLogLevel level, IProgressMonitor monitor)
+ throws ExecutionException {
+ getControlService().enableLogLevel(getSessionName(), null, eventName,
+ logLevelType, level, monitor);
}
/**
* Add contexts to given channels and or events
- * @param contexts - a list of contexts to add
+ *
+ * @param contexts
+ * - a list of contexts to add
* @throws ExecutionException
+ * If the command fails
*/
public void addContexts(List<String> contexts) throws ExecutionException {
addContexts(contexts, new NullProgressMonitor());
/**
* Add contexts to given channels and or events
- * @param contexts - a list of contexts to add
- * @param monitor - a progress monitor
+ *
+ * @param contexts
+ * - a list of contexts to add
+ * @param monitor
+ * - a progress monitor
* @throws ExecutionException
+ * If the command fails
*/
- public void addContexts(List<String> contexts, IProgressMonitor monitor) throws ExecutionException {
- getControlService().addContexts(getSessionName(), null, null, isKernel(), contexts, monitor);
+ public void addContexts(List<String> contexts, IProgressMonitor monitor)
+ throws ExecutionException {
+ getControlService().addContexts(getSessionName(), null, null,
+ isKernel(), contexts, monitor);
}
/**
* Executes calibrate command to quantify LTTng overhead.
+ *
* @throws ExecutionException
+ * If the command fails
*/
public void calibrate() throws ExecutionException {
calibrate(new NullProgressMonitor());
/**
* Executes calibrate command to quantify LTTng overhead.
- * @param monitor - a progress monitor
+ *
+ * @param monitor
+ * - a progress monitor
* @throws ExecutionException
+ * If the command fails
*/
public void calibrate(IProgressMonitor monitor) throws ExecutionException {
getControlService().calibrate(isKernel(), monitor);
/**********************************************************************
* 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.model.impl;
* <p>
* Implementation of the trace channel component.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class TraceEventComponent extends TraceControlComponent {
* Path to icon file for this component (disabled state).
*/
public static final String TRACE_EVENT_ICON_FILE_DISABLED = "icons/obj16/event_disabled.gif"; //$NON-NLS-1$
-
+
// ------------------------------------------------------------------------
// Attributes
// ------------------------------------------------------------------------
* The image to be displayed when in disabled state.
*/
private Image fDisabledImage = null;
-
+
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
/**
- * Constructor
+ * Constructor
* @param name - the name of the component.
* @param parent - the parent of this component.
- */
+ */
public TraceEventComponent(String name, ITraceControlComponent parent) {
super(name, parent);
setImage(TRACE_EVENT_ICON_FILE_ENABLED);
fEventInfo = new EventInfo(name);
fDisabledImage = Activator.getDefault().loadIcon(TRACE_EVENT_ICON_FILE_DISABLED);
}
-
+
// ------------------------------------------------------------------------
// Accessors
// ------------------------------------------------------------------------
}
return super.getImage();
}
-
+
/**
* Sets the event information.
* @param eventInfo - the event information to set.
public void setEventInfo(IEventInfo eventInfo) {
fEventInfo = eventInfo;
}
-
+
/**
* @return the trace event type
*/
public TraceEventType getEventType() {
return fEventInfo.getEventType();
}
-
+
/**
- * Sets the trace event type to the given type
+ * Sets the trace event type to the given type
* @param type - type to set
*/
public void setEventType(TraceEventType type) {
fEventInfo.setEventType(type);
}
-
+
/**
* Sets the trace event type to the type specified by the given name.
- * @param type - event type name
+ * @param typeName - event type name
*/
public void setEventType(String typeName) {
fEventInfo.setEventType(typeName);
public TraceEnablement getState() {
return fEventInfo.getState();
}
-
+
/**
* Sets the event state (enablement) to the given value.
* @param state - state to set.
public void setState(TraceEnablement state) {
fEventInfo.setState(state);
}
-
+
/**
* Sets the event state (enablement) to the value specified by the given name.
* @param stateName - state to set.
public TraceLogLevel getLogLevel() {
return fEventInfo.getLogLevel();
}
-
+
/**
- * Sets the trace event log level to the given level
+ * Sets the trace event log level to the given level
* @param level - event log level to set
*/
public void setLogLevel(TraceLogLevel level) {
fEventInfo.setLogLevel(level);
}
-
+
/**
* Sets the trace event log level to the level specified by the given name.
* @param levelName - event log level name
public void setLogLevel(String levelName) {
fEventInfo.setLogLevel(levelName);
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceControlComponent#getAdapter(java.lang.Class)
return new TraceEventPropertySource(this);
}
return null;
- }
-
+ }
+
/**
* @return session name from parent
*/
public String getSessionName() {
- return ((TraceChannelComponent)getParent()).getSessionName();
+ return ((TraceChannelComponent)getParent()).getSessionName();
}
/**
* @return session from parent
*/
public TraceSessionComponent getSession() {
- return ((TraceChannelComponent)getParent()).getSession();
+ return ((TraceChannelComponent)getParent()).getSession();
}
/**
* @return channel name from parent
*/
public String getChannelName() {
- return getParent().getName();
+ return getParent().getName();
}
/**
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
-
+
/**
* Add contexts to given channels and or events
- * @param contexts - a list of contexts to add
+ *
+ * @param contexts
+ * - a list of contexts to add
* @throws ExecutionException
+ * If the command fails
*/
public void addContexts(List<String> contexts) throws ExecutionException {
addContexts(contexts, new NullProgressMonitor());
/**
* Add contexts to given channels and or events
- * @param contexts - a list of contexts to add
- * @param monitor - a progress monitor
+ *
+ * @param contexts
+ * - a list of contexts to add
+ * @param monitor
+ * - a progress monitor
* @throws ExecutionException
+ * If the command fails
*/
- public void addContexts(List<String> contexts, IProgressMonitor monitor) throws ExecutionException {
- getControlService().addContexts(getSessionName(),getChannelName(), getName(), isKernel(), contexts, monitor);
+ public void addContexts(List<String> contexts, IProgressMonitor monitor)
+ throws ExecutionException {
+ getControlService().addContexts(getSessionName(), getChannelName(),
+ getName(), isKernel(), contexts, monitor);
}
}
/**********************************************************************
* 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.model.impl;
* <p>
* Implementation of the trace provider group.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class TraceProviderGroup extends TraceControlComponent {
* Path to icon file for this component.
*/
public static final String TRACE_PROVIDERS_ICON_FILE = "icons/obj16/providers.gif"; //$NON-NLS-1$
-
+
// ------------------------------------------------------------------------
// Attributes
// ------------------------------------------------------------------------
-
+
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
/**
- * Constructor
+ * Constructor
* @param name - the name of the component.
* @param parent - the parent of this component.
- */
+ */
public TraceProviderGroup(String name, ITraceControlComponent parent) {
super(name, parent);
setImage(TRACE_PROVIDERS_ICON_FILE);
}
-
+
// ------------------------------------------------------------------------
// Accessors
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
-
+
/**
* Gets the provider information from the target node.
- * @throws ExecutionException
+ * @throws ExecutionException If the command fails
*/
public void getProviderFromNode() throws ExecutionException {
getProviderFromNode(new NullProgressMonitor());
/**
* Gets the provider information from the target node.
* @param monitor - a progress monitor
- * @throws ExecutionException
+ * @throws ExecutionException If the command fails
*/
public void getProviderFromNode(IProgressMonitor monitor) throws ExecutionException {
-
+
List<IBaseEventInfo> eventInfos = getControlService().getKernelProvider(monitor);
KernelProviderComponent component = new KernelProviderComponent(Messages.TraceControl_KernelProviderDisplayName, this);
addChild(component);
component.setEventInfo(eventInfos);
-
+
List<IUstProviderInfo> allProviders = getControlService().getUstProvider(monitor);
-
+
for (Iterator<IUstProviderInfo> iterator = allProviders.iterator(); iterator.hasNext();) {
- IUstProviderInfo ustProviderInfo = (IUstProviderInfo) iterator.next();
+ IUstProviderInfo ustProviderInfo = iterator.next();
UstProviderComponent ustComponent = new UstProviderComponent(ustProviderInfo.getName(), this);
addChild(ustComponent);
ustComponent.setUstProvider(ustProviderInfo);
/**********************************************************************
* 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.model.impl;
* <p>
* Implementation of the trace session component.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class TraceSessionComponent extends TraceControlComponent {
// Constructors
// ------------------------------------------------------------------------
/**
- * Constructor
+ * Constructor
* @param name - the name of the component.
* @param parent - the parent of this component.
- */
+ */
public TraceSessionComponent(String name, ITraceControlComponent parent) {
super(name, parent);
setImage(TRACE_SESSION_ICON_FILE_INACTIVE);
if (fSessionInfo.getSessionState() == TraceSessionState.INACTIVE) {
return super.getImage();
}
-
+
return fActiveImage;
}
/**
* Sets the path string (where session is located) to the given value.
- * @param path - session path to set.
+ * @param sessionPath - session path to set.
*/
public void setSessionPath(String sessionPath) {
fSessionInfo.setSessionPath(sessionPath);
return new TraceSessionPropertySource(this);
}
return null;
- }
+ }
/**
* @return all available domains of this session.
*/
public TraceDomainComponent[] getDomains() {
List<ITraceControlComponent> sessions = getChildren(TraceDomainComponent.class);
- return (TraceDomainComponent[])sessions.toArray(new TraceDomainComponent[sessions.size()]);
+ return sessions.toArray(new TraceDomainComponent[sessions.size()]);
}
-
+
/**
* @return the parent target node
*/
public TargetNodeComponent getTargetNode() {
return ((TraceSessionGroup)getParent()).getTargetNode();
}
-
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
+
/**
- * Retrieves the session configuration from the node.
+ * Retrieves the session configuration from the node.
+ *
* @throws ExecutionException
+ * If the command fails
*/
public void getConfigurationFromNode() throws ExecutionException {
getConfigurationFromNode(new NullProgressMonitor());
}
/**
- * Retrieves the session configuration from the node.
- * @param monitor - a progress monitor
+ * Retrieves the session configuration from the node.
+ *
+ * @param monitor
+ * - a progress monitor
* @throws ExecutionException
+ * If the command fails
*/
- public void getConfigurationFromNode(IProgressMonitor monitor) throws ExecutionException {
+ public void getConfigurationFromNode(IProgressMonitor monitor)
+ throws ExecutionException {
removeAllChildren();
fSessionInfo = getControlService().getSession(getName(), monitor);
IDomainInfo[] domains = fSessionInfo.getDomains();
for (int i = 0; i < domains.length; i++) {
- TraceDomainComponent domainComponent = new TraceDomainComponent(domains[i].getName(), this);
+ TraceDomainComponent domainComponent = new TraceDomainComponent(
+ domains[i].getName(), this);
addChild(domainComponent);
domainComponent.setDomainInfo(domains[i]);
}
}
-
+
/**
- * Starts the session.
- * throws ExecutionExecption
+ * Starts the session.
+ *
+ * @throws ExecutionException
+ * If the command fails
*/
public void startSession() throws ExecutionException {
startSession(new NullProgressMonitor());
}
-
+
/**
* Starts the session.
- * @param monitor - a progress monitor
- * throws ExecutionExecption
+ *
+ * @param monitor
+ * - a progress monitor
+ * @throws ExecutionException
+ * If the command fails
*/
- public void startSession(IProgressMonitor monitor) throws ExecutionException {
+ public void startSession(IProgressMonitor monitor)
+ throws ExecutionException {
getControlService().startSession(getName(), monitor);
}
-
+
/**
- * Starts the session.
- * throws ExecutionExecption
+ * Starts the session.
+ *
+ * @throws ExecutionException
+ * If the command fails
*/
public void stopSession() throws ExecutionException {
startSession(new NullProgressMonitor());
}
-
+
/**
* Starts the session.
- * @param monitor - a progress monitor
- * throws ExecutionExecption
+ *
+ * @param monitor
+ * - a progress monitor
+ * @throws ExecutionException
+ * If the command fails
*/
public void stopSession(IProgressMonitor monitor) throws ExecutionException {
getControlService().stopSession(getName(), monitor);
}
/**
- * Enables channels with given names which are part of this domain. If a given channel
- * doesn't exists it creates a new channel with the given parameters (or default values
- * if given parameter is null).
- * @param channelNames - a list of channel names to enable on this domain
- * @param info - channel information to set for the channel (use null for default)
- * @param isKernel - a flag for indicating kernel or UST.
+ * Enables channels with given names which are part of this domain. If a
+ * given channel doesn't exists it creates a new channel with the given
+ * parameters (or default values if given parameter is null).
+ *
+ * @param channelNames
+ * - a list of channel names to enable on this domain
+ * @param info
+ * - channel information to set for the channel (use null for
+ * default)
+ * @param isKernel
+ * - a flag for indicating kernel or UST.
* @throws ExecutionException
+ * If the command fails
*/
- public void enableChannels(List<String> channelNames, IChannelInfo info, boolean isKernel) throws ExecutionException {
+ public void enableChannels(List<String> channelNames, IChannelInfo info,
+ boolean isKernel) throws ExecutionException {
enableChannels(channelNames, info, isKernel, new NullProgressMonitor());
}
/**
- * Enables channels with given names which are part of this domain. If a given channel
- * doesn't exists it creates a new channel with the given parameters (or default values
- * if given parameter is null).
- * @param channelNames - a list of channel names to enable on this domain
- * @param info - channel information to set for the channel (use null for default)
- * @param isKernel - a flag for indicating kernel or UST.
- * @param monitor - a progress monitor
+ * Enables channels with given names which are part of this domain. If a
+ * given channel doesn't exists it creates a new channel with the given
+ * parameters (or default values if given parameter is null).
+ *
+ * @param channelNames
+ * - a list of channel names to enable on this domain
+ * @param info
+ * - channel information to set for the channel (use null for
+ * default)
+ * @param isKernel
+ * - a flag for indicating kernel or UST.
+ * @param monitor
+ * - a progress monitor
* @throws ExecutionException
+ * If the command fails
*/
- public void enableChannels(List<String> channelNames, IChannelInfo info, boolean isKernel, IProgressMonitor monitor) throws ExecutionException {
- getControlService().enableChannels(getName(), channelNames, isKernel, info, monitor);
+ public void enableChannels(List<String> channelNames, IChannelInfo info,
+ boolean isKernel, IProgressMonitor monitor)
+ throws ExecutionException {
+ getControlService().enableChannels(getName(), channelNames, isKernel,
+ info, monitor);
}
-
+
/**
* Enables a list of events with no additional parameters.
- * @param eventNames - a list of event names to enabled.
- * @param isKernel - a flag for indicating kernel or UST.
+ *
+ * @param eventNames
+ * - a list of event names to enabled.
+ * @param isKernel
+ * - a flag for indicating kernel or UST.
* @throws ExecutionException
+ * If the command fails
*/
- public void enableEvent(List<String> eventNames, boolean isKernel) throws ExecutionException {
+ public void enableEvent(List<String> eventNames, boolean isKernel)
+ throws ExecutionException {
enableEvents(eventNames, isKernel, new NullProgressMonitor());
}
/**
* Enables a list of events with no additional parameters.
- * @param eventNames - a list of event names to enabled.
- * @param isKernel - a flag for indicating kernel or UST.
- * @param monitor - a progress monitor
+ *
+ * @param eventNames
+ * - a list of event names to enabled.
+ * @param isKernel
+ * - a flag for indicating kernel or UST.
+ * @param monitor
+ * - a progress monitor
* @throws ExecutionException
+ * If the command fails
*/
- public void enableEvents(List<String> eventNames, boolean isKernel, IProgressMonitor monitor) throws ExecutionException {
- getControlService().enableEvents(getName(), null, eventNames, isKernel, monitor);
+ public void enableEvents(List<String> eventNames, boolean isKernel,
+ IProgressMonitor monitor) throws ExecutionException {
+ getControlService().enableEvents(getName(), null, eventNames, isKernel,
+ monitor);
}
/**
* Enables all syscalls (for kernel domain)
+ *
* @throws ExecutionException
+ * If the command fails
*/
public void enableSyscalls() throws ExecutionException {
enableSyscalls(new NullProgressMonitor());
/**
* Enables all syscalls (for kernel domain)
- * @param monitor - a progress monitor
+ *
+ * @param monitor
+ * - a progress monitor
* @throws ExecutionException
+ * If the command fails
*/
- public void enableSyscalls(IProgressMonitor monitor) throws ExecutionException {
+ public void enableSyscalls(IProgressMonitor monitor)
+ throws ExecutionException {
getControlService().enableSyscalls(getName(), null, monitor);
}
/**
* Enables a dynamic probe (for kernel domain)
- * @param eventName - event name for probe
- * @param isFunction - true for dynamic function entry/return probe else false
- * @param probe - the actual probe
+ *
+ * @param eventName
+ * - event name for probe
+ * @param isFunction
+ * - true for dynamic function entry/return probe else false
+ * @param probe
+ * - the actual probe
* @throws ExecutionException
+ * If the command fails
*/
- public void enableProbe(String eventName, boolean isFunction, String probe) throws ExecutionException {
+ public void enableProbe(String eventName, boolean isFunction, String probe)
+ throws ExecutionException {
enableProbe(eventName, isFunction, probe, new NullProgressMonitor());
}
-
+
/**
* Enables a dynamic probe (for kernel domain)
- * @param eventName - event name for probe
- * @param isFunction - true for dynamic function entry/return probe else false
- * @param probe - the actual probe
- * @param monitor - a progress monitor
+ *
+ * @param eventName
+ * - event name for probe
+ * @param isFunction
+ * - true for dynamic function entry/return probe else false
+ * @param probe
+ * - the actual probe
+ * @param monitor
+ * - a progress monitor
* @throws ExecutionException
+ * If the command fails
*/
- public void enableProbe(String eventName, boolean isFunction, String probe, IProgressMonitor monitor) throws ExecutionException {
- getControlService().enableProbe(getName(), null, eventName, isFunction, probe, monitor);
+ public void enableProbe(String eventName, boolean isFunction, String probe,
+ IProgressMonitor monitor) throws ExecutionException {
+ getControlService().enableProbe(getName(), null, eventName, isFunction,
+ probe, monitor);
}
-
+
/**
* Enables events using log level.
- * @param eventName - a event name
- * @param logLevelType - a log level type
- * @param level - a log level
+ *
+ * @param eventName
+ * - a event name
+ * @param logLevelType
+ * - a log level type
+ * @param level
+ * - a log level
* @throws ExecutionException
+ * If the command fails
*/
- public void enableLogLevel(String eventName, LogLevelType logLevelType, TraceLogLevel level) throws ExecutionException {
- enableLogLevel(eventName, logLevelType, level, new NullProgressMonitor());
+ public void enableLogLevel(String eventName, LogLevelType logLevelType,
+ TraceLogLevel level) throws ExecutionException {
+ enableLogLevel(eventName, logLevelType, level,
+ new NullProgressMonitor());
}
/**
* Enables events using log level.
- * @param eventName - a event name
- * @param logLevelType - a log level type
- * @param level - a log level
- * @param monitor - a progress monitor
+ *
+ * @param eventName
+ * - a event name
+ * @param logLevelType
+ * - a log level type
+ * @param level
+ * - a log level
+ * @param monitor
+ * - a progress monitor
* @throws ExecutionException
+ * If the command fails
*/
- public void enableLogLevel(String eventName, LogLevelType logLevelType, TraceLogLevel level, IProgressMonitor monitor) throws ExecutionException {
- getControlService().enableLogLevel(getName(), null, eventName, logLevelType, level, monitor);
+ public void enableLogLevel(String eventName, LogLevelType logLevelType,
+ TraceLogLevel level, IProgressMonitor monitor)
+ throws ExecutionException {
+ getControlService().enableLogLevel(getName(), null, eventName,
+ logLevelType, level, monitor);
}
-
+
/**
* Gets all available contexts to be added to channels/events.
+ *
* @return the list of available contexts
+ * @throws ExecutionException
+ * If the command fails
*/
public List<String> getContextList() throws ExecutionException {
return getContextList(new NullProgressMonitor());
/**
* Gets all available contexts to be added to channels/events.
+ *
* @param monitor
+ * The monitor that will indicate the progress
* @return the list of available contexts
+ * @throws ExecutionException
+ * If the command fails
*/
- public List<String> getContextList(IProgressMonitor monitor) throws ExecutionException {
+ public List<String> getContextList(IProgressMonitor monitor)
+ throws ExecutionException {
return getControlService().getContextList(monitor);
}
}
/**********************************************************************
* 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.model.impl;
* <p>
* Implementation of the trace session group.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class TraceSessionGroup extends TraceControlComponent {
// ------------------------------------------------------------------------
/**
* Path to icon file for this component.
- */
+ */
public static final String TRACE_SESSIONS_ICON_FILE = "icons/obj16/sessions.gif"; //$NON-NLS-1$
-
+
// ------------------------------------------------------------------------
// Attributes
// ------------------------------------------------------------------------
-
+
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
/**
- * Constructor
+ * Constructor
* @param name - the name of the component.
* @param parent - the parent of this component.
- */
+ */
public TraceSessionGroup(String name, ITraceControlComponent parent) {
super(name, parent);
setImage(TRACE_SESSIONS_ICON_FILE);
// ------------------------------------------------------------------------
/**
* Retrieves the sessions information from the node.
+ *
* @throws ExecutionException
+ * If the command fails
*/
public void getSessionsFromNode() throws ExecutionException {
getSessionsFromNode(new NullProgressMonitor());
/**
* Retrieves the sessions information from the node.
- * @param monitor - a progress monitor
+ *
+ * @param monitor
+ * - a progress monitor
* @throws ExecutionException
+ * If the command fails
*/
- public void getSessionsFromNode(IProgressMonitor monitor) throws ExecutionException {
+ public void getSessionsFromNode(IProgressMonitor monitor)
+ throws ExecutionException {
String[] sessionNames = getControlService().getSessionNames(monitor);
for (int i = 0; i < sessionNames.length; i++) {
- TraceSessionComponent session = new TraceSessionComponent(sessionNames[i], this);
+ TraceSessionComponent session = new TraceSessionComponent(
+ sessionNames[i], this);
addChild(session);
session.getConfigurationFromNode(monitor);
}
}
/**
- * Creates a session with given session name and location.
- * @param sessionName - a session name to create
- * @param sessionPath - a path for storing the traces (use null for default)
- * @return the session information
- * throws ExecutionExecption
+ * Creates a session with given session name and location.
+ *
+ * @param sessionName
+ * - a session name to create
+ * @param sessionPath
+ * - a path for storing the traces (use null for default)
+ * @throws ExecutionException
+ * If the command fails
*/
- public void createSession(String sessionName, String sessionPath) throws ExecutionException {
+ public void createSession(String sessionName, String sessionPath)
+ throws ExecutionException {
createSession(sessionName, sessionPath, new NullProgressMonitor());
}
-
+
/**
- * Creates a session with given session name and location.
- * @param sessionName - a session name to create
- * @param sessionPath - a path for storing the traces (use null for default)
- * @Param monitor - a progress monitor
- * @return the session information
- * throws ExecutionExecption
+ * Creates a session with given session name and location.
+ *
+ * @param sessionName
+ * - a session name to create
+ * @param sessionPath
+ * - a path for storing the traces (use null for default)
+ * @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,
+ IProgressMonitor monitor) throws ExecutionException {
+ ISessionInfo sessionInfo = getControlService().createSession(
+ sessionName, sessionPath, monitor);
if (sessionInfo != null) {
- TraceSessionComponent session = new TraceSessionComponent(sessionInfo.getName(), TraceSessionGroup.this);
+ TraceSessionComponent session = new TraceSessionComponent(
+ sessionInfo.getName(), TraceSessionGroup.this);
addChild(session);
session.getConfigurationFromNode(monitor);
}
}
/**
- * Destroys a session with given session name.
- * @param session - a session component to destroy
- * throws ExecutionExecption
+ * Destroys a session with given session name.
+ *
+ * @param session
+ * - a session component to destroy
+ * @throws ExecutionException
+ * If the command fails
*/
- public void destroySession(TraceSessionComponent session) throws ExecutionException {
+ public void destroySession(TraceSessionComponent session)
+ throws ExecutionException {
destroySession(session, new NullProgressMonitor());
}
-
+
/**
- * Destroys a session with given session name.
- * @param session - a session component to destroy
- * @param monitor - a progress monitor
- * throws ExecutionExecption
+ * Destroys a session with given session name.
+ *
+ * @param session
+ * - a session component to destroy
+ * @param monitor
+ * - a progress monitor
+ * @throws ExecutionException
+ * If the command fails
*/
- public void destroySession(TraceSessionComponent session, IProgressMonitor monitor) throws ExecutionException {
+ public void destroySession(TraceSessionComponent session,
+ IProgressMonitor monitor) throws ExecutionException {
getControlService().destroySession(session.getName(), monitor);
session.removeAllChildren();
removeChild(session);
/**********************************************************************
* 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.preferences;
* <p>
* Preference page implementation for configuring LTTng tracer control preferences.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class ControlPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
// ------------------------------------------------------------------------
RadioGroupFieldEditor fVerboseLevel;
BooleanFieldEditor fIsAppend;
-
+
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
+
+ /**
+ * Constructor
+ */
public ControlPreferencePage() {
super(FieldEditorPreferencePage.GRID);
IPreferenceStore store = ControlPreferences.getInstance().getPreferenceStore();
setPreferenceStore(store);
}
-
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
StringFieldEditor logfile = new StringFieldEditor(ControlPreferences.TRACE_CONTROL_LOG_FILE_PATH_PREF, Messages.TraceControl_LogfilePath, getFieldEditorParent());
addField(logfile);
-
+
fIsAppend = new BooleanFieldEditor(ControlPreferences.TRACE_CONTROL_LOG_APPEND_PREF, Messages.TraceControl_AppendLogfilePreference, getFieldEditorParent());
addField(fIsAppend);
ControlPreferences.TRACE_CONTROL_VERBOSE_LEVEL_NONE,
},
{
- Messages.TraceControl_VerboseLevelVerbosePreference,
+ Messages.TraceControl_VerboseLevelVerbosePreference,
ControlPreferences.TRACE_CONTROL_VERBOSE_LEVEL_VERBOSE
},
{
- Messages.TraceControl_VerboseLevelVeryVerbosePreference,
+ Messages.TraceControl_VerboseLevelVeryVerbosePreference,
ControlPreferences.TRACE_CONTROL_VERBOSE_LEVEL_V_VERBOSE
},
{
- Messages.TraceControl_VerboseLevelVeryVeryVerbosePreference,
+ Messages.TraceControl_VerboseLevelVeryVeryVerbosePreference,
ControlPreferences.TRACE_CONTROL_VERBOSE_LEVEL_V_V_VERBOSE
}
},
*/
@Override
public void propertyChange(PropertyChangeEvent event) {
-
+
if (event.getProperty().equals(FieldEditor.VALUE)) {
if (event.getSource() instanceof FieldEditor) {
FieldEditor editor = (FieldEditor) event.getSource();
}
super.propertyChange(event);
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.jface.preference.FieldEditorPreferencePage#performDefaults()
/**********************************************************************
* 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.preferences;
* <p>
* Singleton class to access LTTng tracer control preferences.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class ControlPreferences {
// ------------------------------------------------------------------------
/**
* Returns the trace control preferences singleton instance
- *
+ *
* @return the trace control preferences singleton instance
*/
public synchronized static ControlPreferences getInstance() {
}
/**
- * @return value of tracing group preference
+ * @return value of tracing group preference
*/
public String getTracingGroup() {
return fPreferenceStore.getString(TRACE_CONTROL_TRACING_GROUP_PREF);
}
/**
- * @return whether is logging is enabled
+ * @return whether is logging is enabled
*/
public boolean isLoggingEnabled() {
return fPreferenceStore.getBoolean(TRACE_CONTROL_LOG_COMMANDS_PREF);
}
/**
- * @return whether an existing log file will appended or not
+ * @return whether an existing log file will appended or not
*/
public boolean isAppend() {
return fPreferenceStore.getBoolean(ControlPreferences.TRACE_CONTROL_LOG_APPEND_PREF);
public String getVerboseLevel() {
return fPreferenceStore.getString(TRACE_CONTROL_VERBOSE_LEVEL_PREF);
}
-
+
/**
* @return absolute log file path
*/
public String getLogfilePath() {
return fPreferenceStore.getString(TRACE_CONTROL_LOG_FILE_PATH_PREF);
}
-
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
+
/**
* Initializes the control preferences (e.g. enable open log file)
+ *
+ * @param preferenceStore
+ * The preference store to assign
*/
public void init(IPreferenceStore preferenceStore) {
fPreferenceStore = preferenceStore;
if (fPreferenceStore.getBoolean(ControlPreferences.TRACE_CONTROL_LOG_COMMANDS_PREF)) {
ControlCommandLogger.init(getLogfilePath(), isAppend());
- }
+ }
}
/**
- * Disposes any resource (e.g. close log file).
+ * Disposes any resource (e.g. close log file).
*/
public void dispose() {
ControlCommandLogger.close();
/**********************************************************************
* 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.property;
* <p>
* Property source implementation for the base event component.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class BaseEventPropertySource extends BasePropertySource {
*/
public static final String BASE_EVENT_LOGLEVEL_PROPERTY_ID = "base.event.loglevel"; //$NON-NLS-1$
/**
- * The base event 'name' property name.
+ * The base event 'name' property name.
*/
public static final String BASE_EVENT_NAME_PROPERTY_NAME = Messages.TraceControl_EventNamePropertyName;
/**
* The base event 'log level' property name.
*/
public static final String BASE_EVENT_LOGLEVEL_PROPERTY_NAME = Messages.TraceControl_LogLevelPropertyName;
-
+
// ------------------------------------------------------------------------
// Attributes
// ------------------------------------------------------------------------
/**
- * The base event component which this property source is for.
+ * The base event component which this property source is for.
*/
private final BaseEventComponent fBaseEvent;
-
+
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
public BaseEventPropertySource(BaseEventComponent component) {
fBaseEvent = component;
}
-
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
if (fBaseEvent.getLogLevel() != TraceLogLevel.LEVEL_UNKNOWN) {
list.add(new TextPropertyDescriptor(BASE_EVENT_LOGLEVEL_PROPERTY_ID, BASE_EVENT_LOGLEVEL_PROPERTY_NAME));
}
- return (IPropertyDescriptor [])list.toArray(new IPropertyDescriptor[list.size()]);
+ return list.toArray(new IPropertyDescriptor[list.size()]);
}
/*
/**********************************************************************
* 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.property;
* <p>
* Property source implementation for the trace event component.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class TraceEventPropertySource extends BasePropertySource {
*/
public static final String TRACE_EVENT_STATE_PROPERTY_ID = "trace.event.state"; //$NON-NLS-1$
/**
- * The trace event 'name' property name.
+ * The trace event 'name' property name.
*/
public static final String TRACE_EVENT_NAME_PROPERTY_NAME = Messages.TraceControl_EventNamePropertyName;
/**
// Attributes
// ------------------------------------------------------------------------
/**
- * The event component which this property source is for.
+ * The event component which this property source is for.
*/
protected final TraceEventComponent fEvent;
-
+
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
public TraceEventPropertySource(TraceEventComponent component) {
fEvent = component;
}
-
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
if (fEvent.getLogLevel() != TraceLogLevel.LEVEL_UNKNOWN) {
list.add(new TextPropertyDescriptor(TRACE_EVENT_LOGLEVEL_PROPERTY_ID, TRACE_EVENT_LOGLEVEL_PROPERTY_NAME));
}
- return (IPropertyDescriptor [])list.toArray(new IPropertyDescriptor[list.size()]);
+ return list.toArray(new IPropertyDescriptor[list.size()]);
}
/*
/**********************************************************************
* 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.property;
* <p>
* Property source implementation for the trace probe event component.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class TraceProbeEventPropertySource extends TraceEventPropertySource {
// ------------------------------------------------------------------------
// Attributes
// ------------------------------------------------------------------------
-
+
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
+
+ /**
+ * Constructor
+ *
+ * @param component
+ * A trace event component
+ */
public TraceProbeEventPropertySource(TraceEventComponent component) {
super(component);
if (component.getClass() != TraceProbeEventComponent.class) {
throw new IllegalArgumentException("Invalid type passed. Only class of type TraceProbeEventComponent allowed:\n" + component.getClass()); //$NON-NLS-1$
}
}
-
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
if (fEvent instanceof TraceProbeEventComponent) {
TraceProbeEventComponent event = (TraceProbeEventComponent) fEvent;
if (event.getAddress() != null) {
- list.add(new TextPropertyDescriptor(TRACE_EVENT_PROBE_ADDRESS_PROPERTY_ID, TRACE_EVENT_PROBE_ADDRESS_PROPERTY_NAME));
+ list.add(new TextPropertyDescriptor(TRACE_EVENT_PROBE_ADDRESS_PROPERTY_ID, TRACE_EVENT_PROBE_ADDRESS_PROPERTY_NAME));
}
if (event.getOffset() != null) {
list.add(new TextPropertyDescriptor(TRACE_EVENT_PROBE_SYMBOL_PROPERTY_ID, TRACE_EVENT_PROBE_SYMBOL_PROPERTY_NAME));
}
}
- return (IPropertyDescriptor [])list.toArray(new IPropertyDescriptor[list.size()]);
+ return list.toArray(new IPropertyDescriptor[list.size()]);
}
/*
/**********************************************************************
* 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.remote;
* <p>
* Class containing command result of remote command execution.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class CommandResult implements ICommandResult {
-
+
// ------------------------------------------------------------------------
// Attributes
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
+
+ /**
+ * Constructor
+ *
+ * @param result
+ * The result of the command
+ * @param output
+ * The output, as an array of strings
+ */
public CommandResult(int result, String[] output) {
fResult = result;
if (output != null) {
}
// ------------------------------------------------------------------------
- // Accessor
+ // Accessors
// ------------------------------------------------------------------------
/*
* (non-Javadoc)
/**********************************************************************
* 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:
* Patrick Tasse - Initial API and implementation
* Bernd Hufmann - Updated using Executor Framework
**********************************************************************/
/**
* <p>
- * Implementation of remote command execution using RSE's shell service.
+ * Implementation of remote command execution using RSE's shell service.
* </p>
- *
+ *
* @author Patrick Tasse
* @author Bernd Hufmann
*/
// Constants
// ------------------------------------------------------------------------
- // string to be echo'ed when running command in shell, used to indicate that the command has finished running
+ /** String to be echo'ed when running command in shell, used to indicate that the command has finished running */
public final static String DONE_MARKUP_STRING = "--RSE:donedonedone:--"; //$NON-NLS-1$
-
- //command delimiter for shell
+
+ /** Command delimiter for shell */
public final static String CMD_DELIMITER = "\n"; //$NON-NLS-1$
+ /** Shell "echo" command */
public final static String SHELL_ECHO_CMD = " echo "; //$NON-NLS-1$
- private final static int DEFAULT_TIMEOUT_VALUE = 15000; // in milliseconds
+ /** Default timeout, in milliseconds */
+ private final static int DEFAULT_TIMEOUT_VALUE = 15000;
// ------------------------------------------------------------------------
// Attributes
private IRemoteSystemProxy fProxy = null;
private IHostShell fHostShell = null;
private BufferedReader fBufferReader = null;
- private ExecutorService fExecutor = Executors.newFixedThreadPool(1);
+ private final ExecutorService fExecutor = Executors.newFixedThreadPool(1);
private boolean fIsConnected = false;
-
+
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
+
+ /**
+ * Constructor
+ *
+ * @param proxy
+ * The Remote System proxy
+ */
public CommandShell(IRemoteSystemProxy proxy) {
fProxy = proxy;
}
if (monitor.isCanceled()) {
flushInput();
- throw new CancellationException();
+ throw new CancellationException();
}
if (nextLine.contains(DONE_MARKUP_STRING) && nextLine.contains(SHELL_ECHO_CMD)) {
// check if job was cancelled
if (monitor.isCanceled()) {
flushInput();
- throw new CancellationException();
+ throw new CancellationException();
}
if (!nextLine.contains(DONE_MARKUP_STRING)) {
}
throw new ExecutionException(Messages.TraceControl_ShellNotConnected, null);
}
-
+
// ------------------------------------------------------------------------
// Helper methods
// ------------------------------------------------------------------------
/**
- * Flushes the buffer reader
+ * Flushes the buffer reader
* @throws IOException
*/
private void flushInput() throws IOException {
}
}
}
-
+
/**
- * format the command to be sent into the shell command with the done markup string.
- * The done markup string is needed so we can tell that end of output has been reached.
- *
+ * Format the command to be sent into the shell command with the done markup
+ * string. The done markup string is needed so we can tell that end of
+ * output has been reached.
+ *
* @param cmd
+ * The original command
* @return formatted command string
*/
private String formatShellCommand(String cmd) {
- if (cmd == null || cmd.equals("")) //$NON-NLS-1$
+ if (cmd == null || cmd.equals("")) { //$NON-NLS-1$
return cmd;
+ }
StringBuffer formattedCommand = new StringBuffer();
// Make a multi line command by using \ and \r. This is needed for matching
- // the DONE_MARKUP_STRING in echoed command when having a long command
+ // the DONE_MARKUP_STRING in echoed command when having a long command
// (bigger than max SSH line)
- formattedCommand.append(cmd).append("\\\r;"); //$NON-NLS-1$
+ formattedCommand.append(cmd).append("\\\r;"); //$NON-NLS-1$
formattedCommand.append(SHELL_ECHO_CMD).append(DONE_MARKUP_STRING);
formattedCommand.append(" $?"); //$NON-NLS-1$
formattedCommand.append(CMD_DELIMITER);
/**********************************************************************
* 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.remote;
* <p>
* Interface for providing command execution result.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public interface ICommandResult {
/**
- * The result of the command.
- * @return 0 if successful else >0
+ * The result of the command.
+ *
+ * @return 0 if successful else >0
*/
- public int getResult() ;
+ public int getResult();
/**
* Sets the command result value.
+ *
* @param result
+ * The integer result to set
*/
public void setResult(int result);
/**
* Sets the command output.
+ *
* @param output
+ * The output (as an array of Strings) to assign
*/
public void setOutput(String[] output);
}
\ No newline at end of file
/**********************************************************************
* 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.remote;
* <p>
* Interface for a command shell implementation
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public interface ICommandShell {
-
+
/**
* Method to connect the command shell.
+ *
* @throws ExecutionException
+ * If the command fails
*/
public void connect() throws ExecutionException;
-
+
/**
* Method to disconnect the command shell.
*/
public void disconnect();
-
+
/**
* Method to execute a command on the command shell.
- *
- * @param command - the command to executed
- * @param monitor - a progress monitor
+ *
+ * @param command
+ * - the command to executed
+ * @param monitor
+ * - a progress monitor
* @return the command result
* @throws ExecutionException
+ * If the command fails
*/
- public ICommandResult executeCommand(String command, IProgressMonitor monitor) throws ExecutionException;
+ public ICommandResult executeCommand(String command,
+ IProgressMonitor monitor) throws ExecutionException;
/**
* Method to execute a command on the command shell.
- *
- * @param command - the command to executed
- * @param monitor - a progress monitor
- * @param checkReturnValue - flag to indicate that the command result should be checked. If false the command result will be always 0.
+ *
+ * @param command
+ * - the command to executed
+ * @param monitor
+ * - a progress monitor
+ * @param checkReturnValue
+ * - flag to indicate that the command result should be checked.
+ * If false the command result will be always 0.
* @return the command result
* @throws ExecutionException
+ * If the command fails
*/
- public ICommandResult executeCommand(final String command, final IProgressMonitor monitor, final boolean checkReturnValue) throws ExecutionException;
+ public ICommandResult executeCommand(final String command,
+ final IProgressMonitor monitor, final boolean checkReturnValue)
+ throws ExecutionException;
}
/**********************************************************************
* 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.remote;
* <p>
* Remote System Proxy interface.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public interface IRemoteSystemProxy {
// ------------------------------------------------------------------------
/**
* Find the first shell service.
- *
+ *
* @return shell service object, or <code>null</code> if not found.
*/
public IShellService getShellService();
/**
* Find the first terminal service.
- *
+ *
* @return shell service object, or <code>null</code> if not found.
*/
public ITerminalService getTerminalService();
/**
* Find the first IShellServiceSubSystem service.
- *
+ *
* @return shell service subsystem, or <code>null</code> if not found.
*/
public ISubSystem getShellServiceSubSystem();
/**
* Find the first ITerminalServiceSubSystem service.
- *
- * @param host the connection
+ *
* @return shell service subsystem, or <code>null</code> if not found.
*/
public ISubSystem getTerminalServiceSubSystem();
-
+
/**
* Finds the File Service Subsystem.
- * @return file service subsystem, or <code>null</code> if not found.
+ *
+ * @return file service subsystem, or <code>null</code> if not found.
*/
public IFileServiceSubSystem getFileServiceSubSystem();
-
+
/**
- * Connects the shell service sub system.
- *
- * @param callback - call-back method being called when connection was finished
- * @throws Exception
+ * Connects the shell service sub system.
+ *
+ * @param callback
+ * - call-back method being called when connection was finished
+ * @throws ExecutionException
+ * If the connection fails
*/
public void connect(IRSECallback callback) throws ExecutionException;
/**
- * Disconnects from the shell service sub system.
- *
- * @throws Exception
+ * Disconnects from the shell service sub system.
+ *
+ * @throws ExecutionException
+ * If the disconnect command fails
*/
public void disconnect() throws ExecutionException;
/**
- * Creates a command shell.
- *
+ * Creates a command shell.
+ *
* @return the command shell implementation
- * @throws Exception
+ * @throws ExecutionException
+ * If the command fails
*/
public ICommandShell createCommandShell() throws ExecutionException;
/**
- * Method to add a communication listener to the connector service defined for
- * the given connection.
- *
- * @param listener - listener to add
- * @throws Exception
+ * Method to add a communication listener to the connector service defined
+ * for the given connection.
+ *
+ * @param listener
+ * - listener to add
*/
public void addCommunicationListener(ICommunicationsListener listener);
/**
- * Method to remove a communication listener from the connector service defined for
- * the given connection.
- *
- * @param listener - listener to remove
- * @throws Exception
+ * Method to remove a communication listener from the connector service
+ * defined for the given connection.
+ *
+ * @param listener
+ * - listener to remove
*/
public void removeCommunicationListener(ICommunicationsListener listener);
/**********************************************************************
* 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.remote;
* <p>
* RemoteSystemProxy implementation.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class RemoteSystemProxy implements IRemoteSystemProxy {
-
+
// ------------------------------------------------------------------------
// Attributes
// ------------------------------------------------------------------------
- private IHost fHost;
+ private final IHost fHost;
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
+
+ /**
+ * Constructor
+ *
+ * @param host
+ * The host of this proxy
+ */
public RemoteSystemProxy(IHost host) {
fHost = host;
}
if (svc!=null) {
ssvc = (IShellService)svc.getAdapter(IShellService.class);
if (ssvc != null) {
- return subSystems[i];
- }
+ return subSystems[i];
+ }
}
}
return null;
if (svc!=null) {
ssvc = (ITerminalService)svc.getAdapter(ITerminalService.class);
if (ssvc != null) {
- return subSystems[i];
- }
+ return subSystems[i];
+ }
}
}
return null;
}
return null;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.util.IRemoteSystemProxy#connect(org.eclipse.rse.core.model.IRSECallback)
*/
shell.connect();
return shell;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.util.IRemoteSystemProxy#addCommunicationListener(org.eclipse.rse.core.subsystems.ICommunicationsListener)
*/
/**********************************************************************
* 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.service;
/**
* <p>
-* Interface for LTTng trace control command service.
+* Interface for LTTng trace control command service.
* </p>
-*
+*
* @author Bernd Hufmann
*/
public interface ILttngControlService {
/**
* Retrieves the existing sessions names from the node.
- * @param monitor - a progress monitor
+ *
+ * @param monitor
+ * - a progress monitor
* @return an array with session names.
* @throws ExecutionException
+ * If the command fails
*/
- public String[] getSessionNames(IProgressMonitor monitor) throws ExecutionException;
-
+ public String[] getSessionNames(IProgressMonitor monitor)
+ throws ExecutionException;
+
/**
* Retrieves the session information with the given name the node.
- * @param sessionName - the session name
- * @param monitor - a progress monitor
+ *
+ * @param sessionName
+ * - the session name
+ * @param monitor
+ * - a progress monitor
* @return session information
* @throws ExecutionException
- */
- public ISessionInfo getSession(String sessionName, IProgressMonitor monitor) throws ExecutionException;
-
+ * If the command fails
+ */
+ public ISessionInfo getSession(String sessionName, IProgressMonitor monitor)
+ throws ExecutionException;
+
/**
* Retrieves the kernel provider information (i.e. the kernel events)
- * @param monitor - a progress monitor
+ *
+ * @param monitor
+ * - a progress monitor
* @return the list of existing kernel events.
* @throws ExecutionException
+ * If the command fails
*/
- public List<IBaseEventInfo> getKernelProvider(IProgressMonitor monitor) throws ExecutionException;
-
+ public List<IBaseEventInfo> getKernelProvider(IProgressMonitor monitor)
+ throws ExecutionException;
+
/**
* Retrieves the UST provider information from the node.
+ *
* @return - the UST provider information.
* @throws ExecutionException
+ * If the command fails
*/
public List<IUstProviderInfo> getUstProvider() throws ExecutionException;
+
/**
* Retrieves the UST provider information from the node.
- * @param monitor - a progress monitor
+ *
+ * @param monitor
+ * - a progress monitor
* @return the UST provider information.
* @throws ExecutionException
+ * If the command fails
*/
- public List<IUstProviderInfo> getUstProvider(IProgressMonitor monitor) throws ExecutionException;
-
+ public List<IUstProviderInfo> getUstProvider(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 monitor - a progress monitor
+ *
+ * @param sessionName
+ * - a session name to create
+ * @param sessionPath
+ * - a path for storing the traces (use null for default)
+ * @param monitor
+ * - a progress monitor
* @return the session information
* @throws ExecutionException
+ * If the command fails
*/
- public ISessionInfo createSession(String sessionName, String sessionPath, IProgressMonitor monitor) throws ExecutionException;
-
+ public ISessionInfo createSession(String sessionName, String sessionPath,
+ IProgressMonitor monitor) throws ExecutionException;
+
/**
- * Destroys a session with given session name.
- * @param sessionName - a session name to destroy
- * @param monitor - a progress monitor
+ * Destroys a session with given session name.
+ *
+ * @param sessionName
+ * - a session name to destroy
+ * @param monitor
+ * - a progress monitor
* @throws ExecutionException
+ * If the command fails
*/
- public void destroySession(String sessionName, IProgressMonitor monitor) throws ExecutionException;
+ public void destroySession(String sessionName, IProgressMonitor monitor)
+ throws ExecutionException;
/**
- * Starts a session with given session name.
- * @param sessionName - a session name to start
- * @param monitor - a progress monitor
+ * Starts a session with given session name.
+ *
+ * @param sessionName
+ * - a session name to start
+ * @param monitor
+ * - a progress monitor
* @throws ExecutionException
- */
- public void startSession(String sessionName, IProgressMonitor monitor) throws ExecutionException;
+ * If the command fails
+ */
+ public void startSession(String sessionName, IProgressMonitor monitor)
+ throws ExecutionException;
- /**
- * Stops a session with given session name.
- * @param sessionName - a session name to stop
- * @param monitor - a progress monitor
- * @throws ExecutionException
- */
- public void stopSession(String sessionName, IProgressMonitor monitor) throws ExecutionException;
+ /**
+ * Stops a session with given session name.
+ *
+ * @param sessionName
+ * - a session name to stop
+ * @param monitor
+ * - a progress monitor
+ * @throws ExecutionException
+ * If the command fails
+ */
+ public void stopSession(String sessionName, IProgressMonitor monitor)
+ throws ExecutionException;
-
- /**
- * Enables a list of channels for given session and given channel information (configuration).
- * @param sessionName - a session name to create
- * @param channelNames - a list of channel names to be enabled
- * @param isKernel - a flag to indicate Kernel or UST (true for Kernel, false for UST)
- * @param info - channel information used for creation of a channel (or null for default)
- * @param monitor - a progress monitor
- * @throws ExecutionException
- */
- public void enableChannels(String sessionName, List<String> channelNames, boolean isKernel, IChannelInfo info, IProgressMonitor monitor) throws ExecutionException;
+ /**
+ * Enables a list of channels for given session and given channel
+ * information (configuration).
+ *
+ * @param sessionName
+ * - a session name to create
+ * @param channelNames
+ * - a list of channel names to be enabled
+ * @param isKernel
+ * - a flag to indicate Kernel or UST (true for Kernel, false for
+ * UST)
+ * @param info
+ * - channel information used for creation of a channel (or null
+ * for default)
+ * @param monitor
+ * - a progress monitor
+ * @throws ExecutionException
+ * If the command fails
+ */
+ public void enableChannels(String sessionName, List<String> channelNames,
+ boolean isKernel, IChannelInfo info, IProgressMonitor monitor)
+ throws ExecutionException;
- /**
- * Disables a list of channels for given session and given channel information (configuration).
- * @param sessionName - a session name to create
- * @param channelNames - a list of channel names to be enabled
- * @param isKernel - a flag to indicate Kernel or UST (true for Kernel, false for UST)
- * @param monitor - a progress monitor
- * @throws ExecutionException
- */
- public void disableChannels(String sessionName, List<String> channelNames, boolean isKernel, IProgressMonitor monitor) throws ExecutionException;
+ /**
+ * Disables a list of channels for given session and given channel
+ * information (configuration).
+ *
+ * @param sessionName
+ * - a session name to create
+ * @param channelNames
+ * - a list of channel names to be enabled
+ * @param isKernel
+ * - a flag to indicate Kernel or UST (true for Kernel, false for
+ * UST)
+ * @param monitor
+ * - a progress monitor
+ * @throws ExecutionException
+ * If the command fails
+ */
+ public void disableChannels(String sessionName, List<String> channelNames,
+ boolean isKernel, IProgressMonitor monitor)
+ throws ExecutionException;
/**
* Enables a list of events with no additional parameters.
- * @param sessionName - a session name
- * @param channelName - a channel name or null for default channel
- * @param eventNames - a list of event names to be enabled, or null (list of size = 0)for all events .
- * @param isKernel - a flag for indicating kernel or UST.
- * @param monitor - a progress monitor
+ *
+ * @param sessionName
+ * - a session name
+ * @param channelName
+ * - a channel name or null for default channel
+ * @param eventNames
+ * - a list of event names to be enabled, or null (list of size =
+ * 0)for all events .
+ * @param isKernel
+ * - a flag for indicating kernel or UST.
+ * @param monitor
+ * - a progress monitor
* @throws ExecutionException
+ * If the command fails
*/
- public void enableEvents(String sessionName, String channelName, List<String> eventNames, boolean isKernel, IProgressMonitor monitor) throws ExecutionException;
+ public void enableEvents(String sessionName, String channelName,
+ List<String> eventNames, boolean isKernel, IProgressMonitor monitor)
+ throws ExecutionException;
/**
* Enables all syscall events.
- * @param sessionName - a session name
- * @param channelName - a channel name or null for default channel
- * @param monitor - a progress monitor
+ *
+ * @param sessionName
+ * - a session name
+ * @param channelName
+ * - a channel name or null for default channel
+ * @param monitor
+ * - a progress monitor
* @throws ExecutionException
+ * If the command fails
*/
- public void enableSyscalls(String sessionName, String channelName, IProgressMonitor monitor) throws ExecutionException;
+ public void enableSyscalls(String sessionName, String channelName,
+ IProgressMonitor monitor) throws ExecutionException;
/**
* Enables a dynamic probe or dynamic function entry/return probe.
- * @param sessionName - a session name
- * @param channelName - a channel name or null for default channel
- * @param eventName - a event name
- * @param isFunction - true for dynamic function entry/return probe else false
- * @param probe - a dynamic probe information
- * @param monitor - a progress monitor
+ *
+ * @param sessionName
+ * - a session name
+ * @param channelName
+ * - a channel name or null for default channel
+ * @param eventName
+ * - a event name
+ * @param isFunction
+ * - true for dynamic function entry/return probe else false
+ * @param probe
+ * - a dynamic probe information
+ * @param monitor
+ * - a progress monitor
* @throws ExecutionException
+ * If the command fails
*/
- public void enableProbe(String sessionName, String channelName, String eventName, boolean isFunction, String probe, IProgressMonitor monitor) throws ExecutionException;
+ public void enableProbe(String sessionName, String channelName,
+ String eventName, boolean isFunction, String probe,
+ IProgressMonitor monitor) throws ExecutionException;
/**
* Enables events using log level
- * @param sessionName - a session name
- * @param channelName - a channel name (null for default channel)
- * @param eventName - a event name
- * @param logLevelType - a log level type
- * @param level - a log level
- * @param monitor - a progress monitor
+ *
+ * @param sessionName
+ * - a session name
+ * @param channelName
+ * - a channel name (null for default channel)
+ * @param eventName
+ * - a event name
+ * @param logLevelType
+ * - a log level type
+ * @param level
+ * - a log level
+ * @param monitor
+ * - a progress monitor
* @throws ExecutionException
+ * If the command fails
*/
- public void enableLogLevel(String sessionName, String channelName, String eventName, LogLevelType logLevelType, TraceLogLevel level, IProgressMonitor monitor) throws ExecutionException;
-
+ public void enableLogLevel(String sessionName, String channelName,
+ String eventName, LogLevelType logLevelType, TraceLogLevel level,
+ IProgressMonitor monitor) throws ExecutionException;
+
/**
* Disables a list of events with no additional parameters.
- * @param sessionName - a session name
- * @param channelName - a channel name (null for default channel)
- * @param eventNames - a list of event names to enabled.
- * @param isKernel - a flag for indicating kernel or UST.
- * @param monitor - a progress monitor
+ *
+ * @param sessionName
+ * - a session name
+ * @param channelName
+ * - a channel name (null for default channel)
+ * @param eventNames
+ * - a list of event names to enabled.
+ * @param isKernel
+ * - a flag for indicating kernel or UST.
+ * @param monitor
+ * - a progress monitor
* @throws ExecutionException
+ * If the command fails
*/
- public void disableEvent(String sessionName, String channelName, List<String> eventNames, boolean isKernel, IProgressMonitor monitor) throws ExecutionException;
-
+ public void disableEvent(String sessionName, String channelName,
+ List<String> eventNames, boolean isKernel, IProgressMonitor monitor)
+ throws ExecutionException;
+
/**
* Gets all available context names to be added to channels/events.
+ *
* @param monitor
+ * The progress monitor
* @return the list of available contexts
+ * @throws ExecutionException
+ * If the command fails
*/
- public List<String> getContextList(IProgressMonitor monitor) throws ExecutionException;
-
+ public List<String> getContextList(IProgressMonitor monitor)
+ throws ExecutionException;
+
/**
* Add contexts to given channels and or events
- * @param sessionName - a session name
- * @param channelName - a channel name (null for all channels)
- * @param eventName - a event name (null for all events)
- * @param isKernel - a flag for indicating kernel or UST.
- * @param contexts - a list of name of contexts to add
- * @param monitor - a progress monitor
+ *
+ * @param sessionName
+ * - a session name
+ * @param channelName
+ * - a channel name (null for all channels)
+ * @param eventName
+ * - a event name (null for all events)
+ * @param isKernel
+ * - a flag for indicating kernel or UST.
+ * @param contexts
+ * - a list of name of contexts to add
+ * @param monitor
+ * - a progress monitor
* @throws ExecutionException
+ * If the command fails
*/
- public void addContexts(String sessionName, String channelName, String eventName, boolean isKernel, List<String> contexts, IProgressMonitor monitor) throws ExecutionException;
-
+ public void addContexts(String sessionName, String channelName,
+ String eventName, boolean isKernel, List<String> contexts,
+ IProgressMonitor monitor) throws ExecutionException;
+
/**
* Executes calibrate command to quantify LTTng overhead.
- * @param isKernel - a flag for indicating kernel or UST.
- * @param monitor - a progress monitor
+ *
+ * @param isKernel
+ * - a flag for indicating kernel or UST.
+ * @param monitor
+ * - a progress monitor
* @throws ExecutionException
+ * If the command fails
*/
- public void calibrate(boolean isKernel, IProgressMonitor monitor) throws ExecutionException;
+ public void calibrate(boolean isKernel, IProgressMonitor monitor)
+ throws ExecutionException;
}
/**********************************************************************
* 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.service;
* <p>
* Service for sending LTTng trace control commands to remote host.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class LTTngControlService implements ILttngControlService {
-
-
+
+
// ------------------------------------------------------------------------
// Attributes
// ------------------------------------------------------------------------
* The command shell implementation
*/
protected ICommandShell fCommandShell = null;
-
+
/**
* The version string.
*/
/**
* Constructor
- *
+ *
* @param shell
* - the command shell implementation to use
*/
public String getVersion() {
return fVersion;
}
-
+
/**
- * Sets the version of the LTTng 2.0 control service.
+ * Sets the version of the LTTng 2.0 control service.
* @param version - a version to set
*/
public void setVersion(String version) {
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
-
+
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService
* #getSessionNames(org.eclipse.core.runtime.IProgressMonitor)
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService
* #getSession(java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
// set channels
domainInfo.setChannels(channels);
-
+
// set kernel flag
domainInfo.setIsKernel(true);
continue;
// set channels
domainInfo.setChannels(channels);
-
+
// set kernel flag
domainInfo.setIsKernel(false);
continue;
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService
* #getKernelProvider(org.eclipse.core.runtime.IProgressMonitor)
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService
* #getUstProvider()
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService
* #getUstProvider(org.eclipse.core.runtime.IProgressMonitor)
//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;
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));
+ throw new ExecutionException(Messages.TraceControl_CommandError + " " + command + "\n" + //$NON-NLS-1$ //$NON-NLS-2$
+ Messages.TraceControl_UnexpectedCommandOutputFormat + ":\n" + //$NON-NLS-1$
+ formatOutput(result));
}
if ((name == null) || (!name.equals(sessionName))) {
// Unexpected name returned
- throw new ExecutionException(Messages.TraceControl_CommandError + " " + command + "\n" + //$NON-NLS-1$ //$NON-NLS-2$
- Messages.TraceControl_UnexpectedNameError + ": " + name); //$NON-NLS-1$
+ 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;
-
+
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));
+ 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$
+ throw new ExecutionException(Messages.TraceControl_CommandError + " " + command + "\n" + //$NON-NLS-1$ //$NON-NLS-2$
Messages.TraceControl_UnexpectedPathError + ": " + name); //$NON-NLS-1$
}
-
+
SessionInfo sessionInfo = new SessionInfo(name);
sessionInfo.setSessionPath(path);
return sessionInfo;
}
-
+
@Override
public void destroySession(String sessionName, IProgressMonitor monitor) throws ExecutionException {
String newName = formatParameter(sessionName);
ICommandResult result = executeCommand(command.toString(), monitor, false);
String[] output = result.getOutput();
-
+
if (isError(result) && ((output == null) || (!LTTngControlServiceConstants.SESSION_NOT_FOUND_ERROR_PATTERN.matcher(output[0]).matches()))) {
throw new ExecutionException(Messages.TraceControl_CommandError + " " + command.toString() + "\n" + formatOutput(result)); //$NON-NLS-1$ //$NON-NLS-2$
}
//Session <sessionName> destroyed
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService#startSession(java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
executeCommand(command.toString(), monitor);
//Session <sessionName> stopped
-
+
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService#enableChannel(java.lang.String, java.util.List, boolean, org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IChannelInfo, org.eclipse.core.runtime.IProgressMonitor)
StringBuffer command = createCommand(LTTngControlServiceConstants.COMMAND_ENABLE_CHANNEL);
for (Iterator<String> iterator = channelNames.iterator(); iterator.hasNext();) {
- String channel = (String) iterator.next();
+ String channel = iterator.next();
command.append(channel);
if (iterator.hasNext()) {
command.append(',');
// (default: 8, kernel default: 4)
command.append(LTTngControlServiceConstants.OPTION_NUM_SUB_BUFFERS);
command.append(String.valueOf(info.getNumberOfSubBuffers()));
-
+
// --switch-timer USEC Switch timer interval in usec (default: 0)
command.append(LTTngControlServiceConstants.OPTION_SWITCH_TIMER);
command.append(String.valueOf(info.getSwitchTimer()));
// --read-timer USEC Read timer interval in usec (default: 200)
command.append(LTTngControlServiceConstants.OPTION_READ_TIMER);
command.append(String.valueOf(info.getReadTimer()));
- }
+ }
executeCommand(command.toString(), monitor);
-
+
}
/*
*/
@Override
public void disableChannels(String sessionName, List<String> channelNames, boolean isKernel, IProgressMonitor monitor) throws ExecutionException {
-
+
// no channels to enable
if (channelNames.isEmpty()) {
return;
StringBuffer command = createCommand(LTTngControlServiceConstants.COMMAND_DISABLE_CHANNEL);
for (Iterator<String> iterator = channelNames.iterator(); iterator.hasNext();) {
- String channel = (String) iterator.next();
+ String channel = iterator.next();
command.append(channel);
if (iterator.hasNext()) {
command.append(',');
executeCommand(command.toString(), monitor);
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService#enableEvent(java.lang.String, java.lang.String, java.util.List, boolean, org.eclipse.core.runtime.IProgressMonitor)
} else {
for (Iterator<String> iterator = eventNames.iterator(); iterator.hasNext();) {
- String event = (String) iterator.next();
+ String event = iterator.next();
command.append(event);
if (iterator.hasNext()) {
command.append(',');
command.append(LTTngControlServiceConstants.OPTION_CHANNEL);
command.append(channelName);
}
-
+
command.append(LTTngControlServiceConstants.OPTION_TRACEPOINT);
-
+
executeCommand(command.toString(), monitor);
-
+
}
/*
command.append(LTTngControlServiceConstants.OPTION_CHANNEL);
command.append(channelName);
}
-
+
command.append(LTTngControlServiceConstants.OPTION_SYSCALL);
-
+
executeCommand(command.toString(), monitor);
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService#enableProbe(java.lang.String, java.lang.String, java.lang.String, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
} else {
command.append(LTTngControlServiceConstants.OPTION_PROBE);
}
-
+
command.append(probe);
-
+
executeCommand(command.toString(), monitor);
}
command.append(LTTngControlServiceConstants.OPTION_CHANNEL);
command.append(channelName);
}
-
+
if (logLevelType == LogLevelType.LOGLEVEL) {
command.append(LTTngControlServiceConstants.OPTION_LOGLEVEL);
} else if (logLevelType == LogLevelType.LOGLEVEL_ONLY) {
command.append(LTTngControlServiceConstants.OPTION_LOGLEVEL_ONLY);
-
+
} else {
return;
}
command.append(level.getInName());
-
+
executeCommand(command.toString(), monitor);
-
+
}
/*
}
for (Iterator<String> iterator = eventNames.iterator(); iterator.hasNext();) {
- String event = (String) iterator.next();
+ String event = iterator.next();
command.append(event);
if (iterator.hasNext()) {
command.append(',');
ICommandResult result = executeCommand(command.toString(), monitor);
- String[] output = result.getOutput();
-
+ String[] output = result.getOutput();
+
List<String> contexts = new ArrayList<String>(0);
-
+
int index = 0;
boolean inList = false;
while (index < output.length) {
String line = result.getOutput()[index];
-
+
Matcher startMatcher = LTTngControlServiceConstants.ADD_CONTEXT_HELP_CONTEXTS_INTRO.matcher(line);
Matcher endMatcher = LTTngControlServiceConstants.ADD_CONTEXT_HELP_CONTEXTS_END_LINE.matcher(line);
String newSessionName = formatParameter(sessionName);
command.append(LTTngControlServiceConstants.OPTION_SESSION);
command.append(newSessionName);
-
+
if (channelName != null) {
command.append(LTTngControlServiceConstants.OPTION_CHANNEL);
command.append(channelName);
} else {
command.append(LTTngControlServiceConstants.OPTION_UST);
}
-
+
for (Iterator<String> iterator = contextNames.iterator(); iterator.hasNext();) {
- String context = (String) iterator.next();
+ String context = iterator.next();
command.append(LTTngControlServiceConstants.OPTION_CONTEXT_TYPE);
command.append(context);
}
executeCommand(command.toString(), monitor);
-
+
}
/*
executeCommand(command.toString(), monitor);
}
-
+
// ------------------------------------------------------------------------
// Helper methods
// ------------------------------------------------------------------------
/**
* Checks if command result is an error result.
- *
+ *
* @param result
* - the command result to check
* @return true if error else false
/**
* Formats the output string as single string.
- *
+ *
* @param output
* - output array
* @return - the formatted output
/**
* Parses the domain information.
- *
+ *
* @param output
* - a command output array
* @param currentIndex
/**
* Parses the event information within a domain.
- *
+ *
* @param output
* - a command output array
* @param currentIndex
} else if (LTTngControlServiceConstants.DOMAIN_UST_GLOBAL_PATTERN.matcher(line).matches()) {
// end of domain
return index;
- }
+ }
Matcher matcher = LTTngControlServiceConstants.EVENT_PATTERN.matcher(line);
Matcher matcher2 = LTTngControlServiceConstants.WILDCARD_EVENT_PATTERN.matcher(line);
eventInfo.setLogLevel(TraceLogLevel.LEVEL_UNKNOWN);
eventInfo.setEventType(matcher2.group(2).trim());
eventInfo.setState(matcher2.group(3));
-
+
if (eventInfo.getEventType() == TraceEventType.PROBE) {
IProbeEventInfo probeEvent = new ProbeEventInfo(eventInfo.getName());
probeEvent.setLogLevel(eventInfo.getLogLevel());
}
// else if (line.matches(EVENT_NONE_PATTERN)) {
// do nothing
-// } else
+// } else
}
/**
* Parses a line with attributes: <attribute Name>: <attribute value>
- *
+ *
* @param line
* - attribute line to parse
* @return the attribute value as string
/**
* Parses the event information within a provider.
- *
+ *
* @param output
* - a command output array
* @param currentIndex
}
/**
- * Formats a command parameter for the command execution i.e. adds quotes
+ * Formats a command parameter for the command execution i.e. adds quotes
* at the beginning and end if necessary.
* @param parameter - parameter to format
* @return formated parameter
}
if (ControlPreferences.TRACE_CONTROL_VERBOSE_LEVEL_V_VERBOSE.equals(level)) {
return LTTngControlServiceConstants.OPTION_VERY_VERBOSE;
- }
+ }
if (ControlPreferences.TRACE_CONTROL_VERBOSE_LEVEL_V_V_VERBOSE.equals(level)) {
return LTTngControlServiceConstants.OPTION_VERY_VERY_VERBOSE;
}
}
/**
- * Method that logs the command and command result if logging is enabled as well as forwards
- * the command execution to the shell.
- * @param command - the command to execute
- * @param monitor - a progress monitor
+ * Method that logs the command and command result if logging is enabled as
+ * well as forwards the command execution to the shell.
+ *
+ * @param command
+ * - the command to execute
+ * @param monitor
+ * - a progress monitor
* @return the command result
* @throws ExecutionException
*/
- protected ICommandResult executeCommand(String command, IProgressMonitor monitor) throws ExecutionException {
+ protected ICommandResult executeCommand(String command,
+ IProgressMonitor monitor) throws ExecutionException {
return executeCommand(command, monitor, true);
}
-
+
/**
- * Method that logs the command and command result if logging is enabled as well as forwards
- * the command execution to the shell.
- * @param command - the command to execute
- * @param monitor - a progress monitor
- * @param - checkForError - true to verify command result, else false
+ * Method that logs the command and command result if logging is enabled as
+ * well as forwards the command execution to the shell.
+ *
+ * @param command
+ * - the command to execute
+ * @param monitor
+ * - a progress monitor
+ * @param checkForError
+ * - true to verify command result, else false
* @return the command result
- * @throws ExecutionException in case of error result
+ * @throws ExecutionException
+ * in case of error result
*/
- protected ICommandResult executeCommand(String command, IProgressMonitor monitor, boolean checkForError) throws ExecutionException {
+ protected ICommandResult executeCommand(String command,
+ IProgressMonitor monitor, boolean checkForError)
+ throws ExecutionException {
if (ControlPreferences.getInstance().isLoggingEnabled()) {
ControlCommandLogger.log(command);
}
- ICommandResult result = fCommandShell.executeCommand(command.toString(), monitor);
-
+ ICommandResult result = fCommandShell.executeCommand(
+ command.toString(), monitor);
+
if (ControlPreferences.getInstance().isLoggingEnabled()) {
ControlCommandLogger.log(formatOutput(result));
}
if (isError(result)) {
- throw new ExecutionException(Messages.TraceControl_CommandError + " " + command.toString() + "\n" + formatOutput(result)); //$NON-NLS-1$ //$NON-NLS-2$
+ throw new ExecutionException(Messages.TraceControl_CommandError
+ + " " + command.toString() + "\n" + formatOutput(result)); //$NON-NLS-1$ //$NON-NLS-2$
}
-
+
return result;
}
}
/**********************************************************************
* 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.service;
* <p>
* Constants for LTTng Control Service.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class LTTngControlServiceConstants {
// ------------------------------------------------------------------------
// Version constants
// ------------------------------------------------------------------------
+ /**
+ * Constant for the LTTng toolchain version
+ */
public final static String LTTNG_MAJOR_VERSION_2_0 = "2.0"; //$NON-NLS-1$
// ------------------------------------------------------------------------
*/
public final static String COMMAND_LIST_UST = COMMAND_LIST + "-u"; //$NON-NLS-1$
/**
- * Command to create a session.
+ * Command to create a session.
*/
public final static String COMMAND_CREATE_SESSION = " create "; //$NON-NLS-1$
/**
- * Command to destroy a session.
+ * Command to destroy a session.
*/
public final static String COMMAND_DESTROY_SESSION = " destroy "; //$NON-NLS-1$
/**
- * Command to destroy a session.
+ * Command to destroy a session.
*/
public final static String COMMAND_START_SESSION = " start "; //$NON-NLS-1$
/**
- * Command to destroy a session.
+ * Command to destroy a session.
*/
public final static String COMMAND_STOP_SESSION = " stop "; //$NON-NLS-1$
/**
- * Command to enable a channel.
+ * Command to enable a channel.
*/
public final static String COMMAND_ENABLE_CHANNEL = " enable-channel "; //$NON-NLS-1$
/**
- * Command to disable a channel.
+ * Command to disable a channel.
*/
public final static String COMMAND_DISABLE_CHANNEL = " disable-channel "; //$NON-NLS-1$
/**
- * Command to enable a event.
+ * Command to enable a event.
*/
public final static String COMMAND_ENABLE_EVENT = " enable-event "; //$NON-NLS-1$
/**
- * Command to disable a event.
+ * Command to disable a event.
*/
public final static String COMMAND_DISABLE_EVENT = " disable-event "; //$NON-NLS-1$
/**
/**
* Optional command line option for configuring a channel's overwrite mode.
*/
- public final static String OPTION_OVERWRITE = " --overwrite "; //$NON-NLS-1$
+ public final static String OPTION_OVERWRITE = " --overwrite "; //$NON-NLS-1$
/**
* Optional command line option for configuring a channel's number of sub buffers.
*/
*/
public final static String OPTION_READ_TIMER = " --read-timer "; //$NON-NLS-1$
/**
- * Command line option for printing the help of a specif command
+ * Command line option for printing the help of a specif command
*/
public final static String OPTION_HELP = " -h "; //$NON-NLS-1$
/**********************************************************************
* 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.service;
* Factory to create LTTngControlService instances depending on the version of the LTTng Trace Control
* installed on the remote host.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class LTTngControlServiceFactory {
* The singleton instance.
*/
private static LTTngControlServiceFactory fInstance = null;
-
+
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
// Factory method
// ------------------------------------------------------------------------
/**
- * Gets the LTTng Control Service implementation based on the version of the
+ * Gets the LTTng Control Service implementation based on the version of the
* remote LTTng Tools.
- *
+ *
* @param shell - the shell implementation to pass to the service
* @return - LTTng Control Service implementation
- * @throws ExecutionException
+ * @throws ExecutionException If the command fails
*/
public ILttngControlService getLttngControlService(ICommandShell shell) throws ExecutionException {
// get the version
ICommandResult result = shell.executeCommand(LTTngControlServiceConstants.CONTROL_COMMAND + LTTngControlServiceConstants.COMMAND_VERSION, new NullProgressMonitor());
-
+
if ((result != null) && (result.getResult() == 0) && (result.getOutput().length >= 1) && (!LTTngControlServiceConstants.ERROR_PATTERN.matcher(result.getOutput()[0]).matches())) {
int index = 0;
while (index < result.getOutput().length) {