projects
/
deliverable
/
tracecompass.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Allow LTTng Control to connect to LTTng 2.x.y nodes (Bug 388545)
[deliverable/tracecompass.git]
/
org.eclipse.linuxtools.lttng2.ui
/
src
/
org
/
eclipse
/
linuxtools
/
internal
/
lttng2
/
ui
/
views
/
control
/
model
/
impl
/
TargetNodeComponent.java
diff --git
a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TargetNodeComponent.java
b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TargetNodeComponent.java
index ab5b160a9044d76e85deb2a9c386564097b30b93..94a6678ba0ce6f7af535a330d66aa8bd9f233431 100644
(file)
--- a/
org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TargetNodeComponent.java
+++ b/
org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TargetNodeComponent.java
@@
-1,12
+1,12
@@
/**********************************************************************
* Copyright (c) 2012 Ericsson
/**********************************************************************
* 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
* 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;
* Bernd Hufmann - Initial API and implementation
**********************************************************************/
package org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl;
@@
-18,28
+18,31
@@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.linuxtools.internal.lttng2.core.control.model.TargetNodeState;
import org.eclipse.linuxtools.internal.lttng2.ui.Activator;
import org.eclipse.linuxtools.internal.lttng2.ui.Activator;
-import org.eclipse.linuxtools.internal.lttng2.ui.views.control.Messages;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.
messages.
Messages;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponent;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponent;
-import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.TargetNodeState;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.property.TargetNodePropertySource;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.property.TargetNodePropertySource;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.remote.ICommandShell;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.remote.IRemoteSystemProxy;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.remote.RemoteSystemProxy;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.remote.IRemoteSystemProxy;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.remote.RemoteSystemProxy;
-import org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ICommandShell;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService;
-import org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.LTTngControlService;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.LTTngControlServiceFactory;
+import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.IRSECallback;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.IRSECallback;
+import org.eclipse.rse.core.model.ISystemRegistry;
import org.eclipse.rse.core.subsystems.CommunicationsEvent;
import org.eclipse.rse.core.subsystems.ICommunicationsListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.views.properties.IPropertySource;
/**
import org.eclipse.rse.core.subsystems.CommunicationsEvent;
import org.eclipse.rse.core.subsystems.ICommunicationsListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.views.properties.IPropertySource;
/**
- * <b><u>TargetNodeComponent</u></b>
* <p>
* Implementation of the trace node component.
* </p>
* <p>
* Implementation of the trace node component.
* </p>
+ *
+ * @author Bernd Hufmann
*/
public class TargetNodeComponent extends TraceControlComponent implements ICommunicationsListener {
*/
public class TargetNodeComponent extends TraceControlComponent implements ICommunicationsListener {
@@
-87,7
+90,7
@@
public class TargetNodeComponent extends TraceControlComponent implements ICommu
// Constructors
// ------------------------------------------------------------------------
/**
// Constructors
// ------------------------------------------------------------------------
/**
- * Constructor
+ * Constructor
* @param name - the name of the component
* @param parent - the parent of the component
* @param host - the host connection implementation
* @param name - the name of the component
* @param parent - the parent of the component
* @param host - the host connection implementation
@@
-103,7
+106,7
@@
public class TargetNodeComponent extends TraceControlComponent implements ICommu
}
/**
}
/**
- * 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
* @param name - the name of the component
* @param parent - the parent of the component
* @param host - the host connection implementation
@@
-126,7
+129,7
@@
public class TargetNodeComponent extends TraceControlComponent implements ICommu
}
return fDisconnectedImage;
}
}
return fDisconnectedImage;
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceControlComponent#getTargetNodeState()
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceControlComponent#getTargetNodeState()
@@
-135,7
+138,7
@@
public class TargetNodeComponent extends TraceControlComponent implements ICommu
public TargetNodeState getTargetNodeState() {
return fState;
}
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)
/*
* (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)
@@
-145,7
+148,7
@@
public class TargetNodeComponent extends TraceControlComponent implements ICommu
fState = state;
fireComponentChanged(TargetNodeComponent.this);
}
fState = state;
fireComponentChanged(TargetNodeComponent.this);
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceControlComponent#getControlService()
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceControlComponent#getControlService()
@@
-161,22
+164,21
@@
public class TargetNodeComponent extends TraceControlComponent implements ICommu
*/
@Override
public void setControlService(ILttngControlService service) {
*/
@Override
public void setControlService(ILttngControlService service) {
- fService =
(ILttngControlService)
service;
+ fService = service;
}
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceControlComponent#getAdapter(java.lang.Class)
*/
}
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceControlComponent#getAdapter(java.lang.Class)
*/
- @SuppressWarnings("rawtypes")
@Override
public Object getAdapter(Class adapter) {
if (adapter == IPropertySource.class) {
return new TargetNodePropertySource(this);
}
return null;
@Override
public Object getAdapter(Class adapter) {
if (adapter == IPropertySource.class) {
return new TargetNodePropertySource(this);
}
return null;
- }
-
+ }
+
/**
* @return remote host name
*/
/**
* @return remote host name
*/
@@
-197,17
+199,28
@@
public class TargetNodeComponent extends TraceControlComponent implements ICommu
public TraceSessionComponent[] getSessions() {
List<ITraceControlComponent> compenents = getChildren(TraceSessionGroup.class);
if (compenents.size() > 0) {
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);
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];
}
}
return new TraceSessionComponent[0];
}
-
+
+ /**
+ * @return node version
+ */
+ public String getNodeVersion() {
+ // Control service is null during connection to node
+ if (getControlService() != null) {
+ return getControlService().getVersion();
+ }
+ return ""; //$NON-NLS-1$
+ }
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
-
+
/*
* @see org.eclipse.rse.core.subsystems.ICommunicationsListener#communicationsStateChange(org.eclipse.rse.core.subsystems.CommunicationsEvent)
*/
/*
* @see org.eclipse.rse.core.subsystems.ICommunicationsListener#communicationsStateChange(org.eclipse.rse.core.subsystems.CommunicationsEvent)
*/
@@
-258,8
+271,7
@@
public class TargetNodeComponent extends TraceControlComponent implements ICommu
});
} catch (Exception e) {
setTargetNodeState(TargetNodeState.DISCONNECTED);
});
} catch (Exception e) {
setTargetNodeState(TargetNodeState.DISCONNECTED);
- Activator.getDefault().getLog().log(
- new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_ConnectionFailure + " (" + getName() + "). \n" + e)); //$NON-NLS-1$ //$NON-NLS-2$
+ Activator.getDefault().logError(Messages.TraceControl_ConnectionFailure + " (" + getName() + "). \n", e); //$NON-NLS-1$ //$NON-NLS-2$
}
}
}
}
}
}
@@
-273,19
+285,16
@@
public class TargetNodeComponent extends TraceControlComponent implements ICommu
setTargetNodeState(TargetNodeState.DISCONNECTING);
fRemoteProxy.disconnect();
} catch (Exception e) {
setTargetNodeState(TargetNodeState.DISCONNECTING);
fRemoteProxy.disconnect();
} catch (Exception e) {
- Activator.getDefault().getLog().log(
- new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_DisconnectionFailure + " (" + getName() + "). \n" + e)); //$NON-NLS-1$ //$NON-NLS-2$
+ Activator.getDefault().logError(Messages.TraceControl_DisconnectionFailure + " (" + getName() + "). \n", e); //$NON-NLS-1$ //$NON-NLS-2$
} finally {
} 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) {
*/
public void getConfigurationFromNode() {
Job job = new Job(Messages.TraceControl_RetrieveNodeConfigurationJob) {
@@
-297,15
+306,15
@@
public class TargetNodeComponent extends TraceControlComponent implements ICommu
TraceProviderGroup providerGroup = new TraceProviderGroup(Messages.TraceControl_ProviderDisplayName, TargetNodeComponent.this);
addChild(providerGroup);
providerGroup.getProviderFromNode(monitor);
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();
// 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, e.toString()
);
- }
+ return new Status(
IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_ListSessionFailure, e
);
+ }
return Status.OK_STATUS;
}
return Status.OK_STATUS;
}
@@
-314,11
+323,22
@@
public class TargetNodeComponent extends TraceControlComponent implements ICommu
job.schedule();
}
job.schedule();
}
+ /**
+ * Refresh the node configuration
+ */
public void refresh() {
removeAllChildren();
getConfigurationFromNode();
}
public void refresh() {
removeAllChildren();
getConfigurationFromNode();
}
+ /**
+ * Deregisters host from registry.
+ */
+ public void deregister() {
+ ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
+ registry.deleteHost(fHost);
+ }
+
// ------------------------------------------------------------------------
// Helper function
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
// Helper function
// ------------------------------------------------------------------------
@@
-331,12
+351,12
@@
public class TargetNodeComponent extends TraceControlComponent implements ICommu
fShell = fRemoteProxy.createCommandShell();
fRemoteProxy.addCommunicationListener(this);
}
fShell = fRemoteProxy.createCommandShell();
fRemoteProxy.addCommunicationListener(this);
}
- fService =
new LTT
ngControlService(fShell);
+ fService =
LTTngControlServiceFactory.getInstance().getLtt
ngControlService(fShell);
return fService;
}
/**
return fService;
}
/**
- * Handles the connected event.
+ * Handles the connected event.
*/
private void handleConnected() {
setTargetNodeState(TargetNodeState.CONNECTED);
*/
private void handleConnected() {
setTargetNodeState(TargetNodeState.CONNECTED);
@@
-344,13
+364,12
@@
public class TargetNodeComponent extends TraceControlComponent implements ICommu
createControlService();
getConfigurationFromNode();
} catch (ExecutionException e) {
createControlService();
getConfigurationFromNode();
} catch (ExecutionException e) {
- Activator.getDefault().getLog().log(
- new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_ListSessionFailure + " (" + getName() + "). \n" + e)); //$NON-NLS-1$ //$NON-NLS-2$
+ Activator.getDefault().logError(Messages.TraceControl_ListSessionFailure + " (" + getName() + "). \n", e); //$NON-NLS-1$ //$NON-NLS-2$
}
}
/**
}
}
/**
- * Handles the disconnected event.
+ * Handles the disconnected event.
*/
private void handleDisconnected() {
removeAllChildren();
*/
private void handleDisconnected() {
removeAllChildren();
This page took
0.027243 seconds
and
5
git commands to generate.