lttng: Support for port number in lttng control (bug 406122)
authorBernd Hufmann <Bernd.Hufmann@ericsson.com>
Wed, 24 Apr 2013 11:50:35 +0000 (07:50 -0400)
committerBernd Hufmann <bernd.hufmann@ericsson.com>
Wed, 24 Apr 2013 15:35:10 +0000 (11:35 -0400)
Change-Id: I38ce9ea1e84f3a57c28cb9877d2033cf42b0af57
Signed-off-by: Bernd Hufmann <Bernd.Hufmann@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/12135
Tested-by: Hudson CI
Reviewed-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
IP-Clean: Alexandre Montplaisir <alexmonthy@voxpopuli.im>

org.eclipse.linuxtools.lttng.help/doc/User-Guide.mediawiki
org.eclipse.linuxtools.lttng.help/doc/images/LTTng2EditConnection.png
org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/service/TestRemoteSystemProxy.java
org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/INewConnectionDialog.java
org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/NewConnectionDialog.java
org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/NewConnectionHandler.java
org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/Messages.java
org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/messages.properties
org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TargetNodeComponent.java
org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/IRemoteSystemProxy.java
org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/RemoteSystemProxy.java

index e8f2d713262be0978ec6d64be43382c997095331..1623e43643ce08b434f91b22141b12252372a0c9 100644 (file)
@@ -742,15 +742,12 @@ To use an existing connection definition, select the relevant entry in the drop-
 
 [[Image:images/LTTng2SelectConnection.png]]
 
-To enter the host information manually select first the button '''Edit connection information'''. Then the text fields '''Connection Name''' and '''Host Name''' will enabled. Enter the relevant information and then select '''Ok'''.
+To enter the host information manually select first the button '''Edit connection information'''. Then the text fields '''Connection Name''', '''Host Name''' and '''Port Number''' will be enabled. The '''Host Name''' holds the IP address or DNS name of the remote system. The '''Connection Name''' is the alias name to be displayed in the Control View. The '''Port Number''' is the port number to be used for the IP connection. This parameter is optional and if it is omitted the default port will be used. Enter the relevant information and then select '''Ok'''.
 
 [[Image:images/LTTng2EditConnection.png]]
 
 A new display will show for providing the user name and password. This display only opens if no password had been saved before. Enter user name and password in the '''Enter Password''' dialog box and select '''Ok'''.
 
-The '''Host Name''' holds the IP address or DNS name of the remote system.
-The '''Connection Name''' is the alias name to be displayed in the Control View.
-
 [[Image:images/LTTng2EnterPassword.png]]
 
 After pressing '''Ok''' the SSH connection will be established and after successful login the Control View implementation retrieves the LTTng Tracer Control information. This information will be displayed in the Control View in form of a tree structure.
index 27a59913c255691c0eaa17088e22cfa77c5deccc..dd5281b8f4936b473ea0d54b62d950a110c7acd2 100644 (file)
Binary files a/org.eclipse.linuxtools.lttng.help/doc/images/LTTng2EditConnection.png and b/org.eclipse.linuxtools.lttng.help/doc/images/LTTng2EditConnection.png differ
index 381d1804ddca281c82035f8551d2aa9a7faf2c76..d802cec7917a602a98ec77930e6b615dd3ad2407 100644 (file)
@@ -1,5 +1,5 @@
 /**********************************************************************
- * Copyright (c) 2012 Ericsson
+ * Copyright (c) 2012, 2013 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -101,4 +101,13 @@ public class TestRemoteSystemProxy implements IRemoteSystemProxy {
             fShell.setScenario(fScenario);
         }
     }
+
+    @Override
+    public int getPort() {
+        return IRemoteSystemProxy.INVALID_PORT_NUMBER;
+    }
+
+    @Override
+    public void setPort(int port) {
+    }
 }
index d6c662fbc8054631aae4eb9785dba80ad1a8cd21..f9736de07ff9f26e86246d390da221a1a0105a74 100644 (file)
@@ -1,12 +1,12 @@
 /**********************************************************************
- * Copyright (c) 2012 Ericsson
- * 
+ * Copyright (c) 2012, 2013 Ericsson
+ *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
  * accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors: 
+ *
+ * Contributors:
  *   Bernd Hufmann - Initial API and implementation
  **********************************************************************/
 package org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs;
@@ -18,11 +18,11 @@ import org.eclipse.rse.core.model.IHost;
  * <p>
  * Interface for connection information dialog.
  * </p>
- * 
+ *
  *  @author Bernd Hufmann
  */
 public interface INewConnectionDialog {
-    
+
     // ------------------------------------------------------------------------
     // Accessors
     // ------------------------------------------------------------------------
@@ -35,19 +35,30 @@ public interface INewConnectionDialog {
      * @return the host name (IP address or DNS name)
      */
     public String getHostName();
-    
+
+    /**
+     * @return port of IP connection to be used
+     */
+    public int getPort();
+
     /**
      * Sets the trace control root
      * @param parent - the trace control parent
      */
     public void setTraceControlParent(ITraceControlComponent parent);
-    
+
     /**
      * Sets the available hosts to select.
      * @param hosts - the available hosts
      */
     public void setHosts(IHost[] hosts);
 
+    /**
+     * Set the port of the IP connection to be used.
+     * @param port - the IP port to set
+     */
+    public void setPort(int port);
+
     // ------------------------------------------------------------------------
     // Operations
     // ------------------------------------------------------------------------
index 752c7a81dcef2b0fc330c05a8fc6c28bc6c34f57..e5a0c867a341d17d848b89795efd2fb1c053f439 100644 (file)
@@ -1,5 +1,5 @@
 /**********************************************************************
- * Copyright (c) 2012 Ericsson
+ * Copyright (c) 2012, 2013 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -19,11 +19,14 @@ import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.linuxtools.internal.lttng2.ui.Activator;
 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.messages.Messages;
 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponent;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.remote.IRemoteSystemProxy;
 import org.eclipse.rse.core.model.IHost;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.CCombo;
 import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.events.VerifyEvent;
+import org.eclipse.swt.events.VerifyListener;
 import org.eclipse.swt.graphics.Point;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
@@ -83,6 +86,10 @@ public class NewConnectionDialog extends Dialog implements INewConnectionDialog
      * The text widget for the node address (IP or DNS name)
      */
     private Text fHostNameText = null;
+    /**
+     * The text widget for the IP port
+     */
+    private Text fPortText = null;
     /**
      * The parent where the new node should be added.
      */
@@ -95,7 +102,10 @@ public class NewConnectionDialog extends Dialog implements INewConnectionDialog
      * The node address (IP or DNS name) string.
      */
     private String fHostName = null;
-
+    /**
+     * The IP port of the connection.
+     */
+    private int fPort = IRemoteSystemProxy.INVALID_PORT_NUMBER;
     /**
      * Input list of existing RSE hosts available for selection.
      */
@@ -136,6 +146,11 @@ public class NewConnectionDialog extends Dialog implements INewConnectionDialog
         return fHostName;
     }
 
+    @Override
+    public int getPort() {
+        return fPort;
+    }
+
     /*
      * (non-Javadoc)
      * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.INewConnectionDialog#setTraceControlParent(org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponent)
@@ -156,6 +171,11 @@ public class NewConnectionDialog extends Dialog implements INewConnectionDialog
         }
     }
 
+    @Override
+    public void setPort(int port) {
+        fPort = port;
+    }
+
     // ------------------------------------------------------------------------
     // Operations
     // ------------------------------------------------------------------------
@@ -227,6 +247,19 @@ public class NewConnectionDialog extends Dialog implements INewConnectionDialog
         fHostNameText.setToolTipText(Messages.TraceControl_NewNodeHostNameTooltip);
         fHostNameText.setEnabled(fExistingHosts.length == 0);
 
+        Label portLabel = new Label(fTextGroup, SWT.RIGHT);
+        portLabel.setText(Messages.TraceControl_NewNodePortLabel);
+        fPortText = new Text(fTextGroup, SWT.NONE);
+        fPortText.setToolTipText(Messages.TraceControl_NewNodePortTooltip);
+        fPortText.setEnabled(fExistingHosts.length == 0);
+        fPortText.addVerifyListener(new VerifyListener() {
+            @Override
+            public void verifyText(VerifyEvent e) {
+                // only numbers are allowed.
+                e.doit = e.text.matches("[0-9]*"); //$NON-NLS-1$
+            }
+        });
+
         fButton.addSelectionListener(new SelectionListener() {
             @Override
             public void widgetSelected(SelectionEvent e) {
@@ -235,10 +268,12 @@ public class NewConnectionDialog extends Dialog implements INewConnectionDialog
                     fExistingHostsCombo.setEnabled(false);
                     fConnectionNameText.setEnabled(true);
                     fHostNameText.setEnabled(true);
+                    fPortText.setEnabled(true);
                 } else {
                     fExistingHostsCombo.setEnabled(true);
                     fConnectionNameText.setEnabled(false);
                     fHostNameText.setEnabled(false);
+                    fPortText.setEnabled(false);
                 }
             }
 
@@ -253,6 +288,7 @@ public class NewConnectionDialog extends Dialog implements INewConnectionDialog
                 int index = fExistingHostsCombo.getSelectionIndex();
                 fConnectionNameText.setText(fExistingHosts[index].getAliasName());
                 fHostNameText.setText(fExistingHosts[index].getHostName());
+                fPortText.setText(""); //$NON-NLS-1$
             }
 
             @Override
@@ -264,12 +300,21 @@ public class NewConnectionDialog extends Dialog implements INewConnectionDialog
         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;
+        int widthHint = minSize.x + 5;
+        data.widthHint = widthHint;
         data.horizontalSpan = 2;
-
         fConnectionNameText.setLayoutData(data);
+
+        data = new GridData(GridData.FILL_HORIZONTAL);
+        data.widthHint = widthHint;
+        data.horizontalSpan = 2;
         fHostNameText.setLayoutData(data);
 
+        data = new GridData(GridData.FILL_HORIZONTAL);
+        data.widthHint = widthHint;
+        data.horizontalSpan = 2;
+        fPortText.setLayoutData(data);
+
         fHostNameText.setText(""); //$NON-NLS-1$
 
         return fDialogComposite;
@@ -294,6 +339,7 @@ public class NewConnectionDialog extends Dialog implements INewConnectionDialog
         // Validate input data
         fConnectionName = fConnectionNameText.getText();
         fHostName = fHostNameText.getText();
+        fPort = (fPortText.getText().length() > 0) ? Integer.parseInt(fPortText.getText()) : IRemoteSystemProxy.INVALID_PORT_NUMBER;
 
         if (!"".equals(fHostName)) { //$NON-NLS-1$
             // If no node name is specified use the node address as name
index e0ae88f94e457310693e34b1ca8fabf2afdc591c..65e4f85a8ebd641b774716ed17694a536915329d 100644 (file)
@@ -1,5 +1,5 @@
 /**********************************************************************
- * Copyright (c) 2012 Ericsson and others
+ * Copyright (c) 2012, 2013 Ericsson and others
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -25,6 +25,7 @@ import org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.TraceCont
 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.impl.TargetNodeComponent;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.remote.IRemoteSystemProxy;
 import org.eclipse.rse.core.IRSESystemType;
 import org.eclipse.rse.core.RSECorePlugin;
 import org.eclipse.rse.core.model.IHost;
@@ -86,6 +87,7 @@ public class NewConnectionHandler extends BaseControlViewHandler {
         final INewConnectionDialog dialog = TraceControlDialogFactory.getInstance().getNewConnectionDialog();
         dialog.setTraceControlParent(fRoot);
         dialog.setHosts(hosts);
+        dialog.setPort(IRemoteSystemProxy.INVALID_PORT_NUMBER);
 
         if (dialog.open() != Window.OK) {
             return null;
@@ -93,6 +95,7 @@ public class NewConnectionHandler extends BaseControlViewHandler {
 
         String hostName = dialog.getConnectionName();
         String hostAddress = dialog.getHostName();
+        int port = dialog.getPort();
 
         // get the singleton RSE registry
         IHost host = null;
@@ -129,6 +132,7 @@ public class NewConnectionHandler extends BaseControlViewHandler {
                 TargetNodeComponent node = null;
                 if (!fRoot.containsChild(hostName)) {
                     node = new TargetNodeComponent(hostName, fRoot, host);
+                    node.setPort(port);
                     fRoot.addChild(node);
                 }
                 else {
index c5467c3a1570ccc4077d279bcfe6cccc937045a1..a7d541b51672a39d40d1b0a4f86c96e0e5899088 100644 (file)
@@ -93,6 +93,8 @@ final public class Messages extends NLS {
     public static String TraceControl_NewNodeConnectionNameTooltip;
     public static String TraceControl_NewNodeHostNameLabel;
     public static String TraceControl_NewNodeHostNameTooltip;
+    public static String TraceControl_NewNodePortLabel;
+    public static String TraceControl_NewNodePortTooltip;
     public static String TraceControl_AlreadyExistsError;
 
     public static String TraceControl_CreateSessionDialogTitle;
index 5c1f487b7c4cc2e962a8cb256441a72e308e2e67..6097feececd6ccf40fc7da80419c94d25e6c54fd 100644 (file)
@@ -76,6 +76,8 @@ TraceControl_NewNodeConnectionNameLabel=Connection Name
 TraceControl_NewNodeConnectionNameTooltip=Alias to be displayed for node to connect to. 
 TraceControl_NewNodeHostNameLabel=Host Name
 TraceControl_NewNodeHostNameTooltip=IP Address or DNS name of node to connect to.
+TraceControl_NewNodePortLabel=Port Number
+TraceControl_NewNodePortTooltip=IP Port Number to be used for the connection. Leave empty for default port.
 TraceControl_AlreadyExistsError=Node name already exists in Control View
 
 TraceControl_CreateSessionDialogTitle=Create Session
index 2546d7c9a59de4bb5b0cb0bad922a442c6f78b9c..907390d70bb73530751c0a3f56735161dfa5de13 100644 (file)
@@ -197,6 +197,21 @@ public class TargetNodeComponent extends TraceControlComponent implements ICommu
         return fRemoteProxy;
     }
 
+    /**
+     * @return port of IP connection (shell) to be used
+     */
+    public int getPort() {
+        return fRemoteProxy.getPort();
+    }
+
+    /**
+     * Sets the port of the IP connections of the shell
+     * @param port - the IP port to set
+     */
+    public void setPort(int port) {
+        fRemoteProxy.setPort(port);
+    }
+
     /**
      * @return all available sessions.
      */
index 7ffc7aea25b0b4f5b588ec98efb0fd610d334ce8..a7670a0e7dd13b1fff2c657f0ecdcada095604e0 100644 (file)
@@ -1,5 +1,5 @@
 /**********************************************************************
- * Copyright (c) 2012 Ericsson
+ * Copyright (c) 2012, 2013 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -28,6 +28,14 @@ import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSys
  */
 public interface IRemoteSystemProxy {
 
+    // ------------------------------------------------------------------------
+    // Constants
+    // ------------------------------------------------------------------------
+    /**
+     * Invalid port number for IP based connections.
+     */
+    public final static int INVALID_PORT_NUMBER = -1;
+
     // ------------------------------------------------------------------------
     // Operations
     // ------------------------------------------------------------------------
@@ -66,6 +74,17 @@ public interface IRemoteSystemProxy {
      */
     public IFileServiceSubSystem getFileServiceSubSystem();
 
+    /**
+     * @return port of IP connection to be used
+     */
+    public int getPort();
+
+    /**
+     * Sets the port of the IP connection.
+     * @param port - the IP port to set
+     */
+    public void setPort(int port);
+
     /**
      * Connects the shell service sub system.
      *
index 4666d8d4ac5faa92fe91aefeda1246f857ff180e..e03adeb224d764902018f5eb5a4ab0639c082f1d 100644 (file)
@@ -1,5 +1,5 @@
 /**********************************************************************
- * Copyright (c) 2012 Ericsson
+ * Copyright (c) 2012, 2013 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -141,8 +141,24 @@ public class RemoteSystemProxy implements IRemoteSystemProxy {
         return null;
     }
 
-    /* (non-Javadoc)
-     * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.util.IRemoteSystemProxy#connect(org.eclipse.rse.core.model.IRSECallback)
+    @Override
+    public int getPort() {
+        if (getShellServiceSubSystem() != null) {
+            return getShellServiceSubSystem().getConnectorService().getPort();
+        }
+        return IRemoteSystemProxy.INVALID_PORT_NUMBER;
+    }
+
+    @Override
+    public void setPort(int port) {
+        if ((getShellServiceSubSystem() != null) && (port > 0)) {
+            getShellServiceSubSystem().getConnectorService().setPort(port);
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.remote.IRemoteSystemProxy#connect(org.eclipse.rse.core.model.IRSECallback)
      */
     @Override
     public void connect(IRSECallback callback) throws ExecutionException {
This page took 0.035347 seconds and 5 git commands to generate.