Remove temporary USB (TCF) connection and move TCF-related services into Carbide EDC
authorEd Swartz <ed.swartz@nokia.com>
Wed, 30 Jun 2010 14:00:29 -0500
changeset 1559 cc9cfb62406b
parent 1558 79c7bcfddffc
child 1564 1c3ed56966df
Remove temporary USB (TCF) connection and move TCF-related services into Carbide EDC
debuggercdi/com.nokia.carbide.trk.support/META-INF/MANIFEST.MF
debuggercdi/com.nokia.carbide.trk.support/plugin.xml
debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/connection/TCFConnection.java
debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/connection/TCFConnectionFactory.java
debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/connection/TCFConnectionType.java
debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/connection/TCFUSBConnection.java
debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/connection/TCFUSBConnectionType.java
debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/messages.properties
debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/ConnectedServiceFactory.java
debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/TRKService.java
debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/TracingService.java
debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/status/ConnectionStatusReconciler.java
--- a/debuggercdi/com.nokia.carbide.trk.support/META-INF/MANIFEST.MF	Tue Jun 29 18:31:46 2010 -0500
+++ b/debuggercdi/com.nokia.carbide.trk.support/META-INF/MANIFEST.MF	Wed Jun 30 14:00:29 2010 -0500
@@ -18,6 +18,6 @@
  lib/commons-httpclient-3.1.jar,
  lib/commons-codec-1.3.jar,
  lib/commons-logging-1.1.jar
-Export-Package: com.nokia.carbide.trk.support.connection;x-friends:="com.nokia.carbide.symsee.trk.support",
- com.nokia.carbide.trk.support.service;x-friends:="com.nokia.carbide.symsee.trk.support,com.nokia.cdt.debug.launch.platSim"
+Export-Package: com.nokia.carbide.trk.support.connection;x-friends:="com.nokia.carbide.symsee.trk.support,com.nokia.carbide.cpp.edc",
+ com.nokia.carbide.trk.support.service;x-friends:="com.nokia.carbide.symsee.trk.support,com.nokia.cdt.debug.launch.platSim,com.nokia.carbide.cpp.edc"
 Bundle-RequiredExecutionEnvironment: J2SE-1.5
--- a/debuggercdi/com.nokia.carbide.trk.support/plugin.xml	Tue Jun 29 18:31:46 2010 -0500
+++ b/debuggercdi/com.nokia.carbide.trk.support/plugin.xml	Wed Jun 30 14:00:29 2010 -0500
@@ -44,18 +44,5 @@
             class="com.nokia.carbide.trk.support.connection.TCPIPConnectionType">
       </connectionType>
    </extension>
-   
-   <extension
-         point="com.nokia.carbide.remoteConnections.connectionType">
-      <connectionType
-            class="com.nokia.carbide.trk.support.connection.TCFConnectionType">
-      </connectionType>
-   </extension>
-   <extension
-         point="com.nokia.carbide.remoteConnections.connectionType">
-      <connectionType
-            class="com.nokia.carbide.trk.support.connection.TCFUSBConnectionType">
-      </connectionType>
-   </extension>
- 	
+
 </plugin>
--- a/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/connection/TCFConnection.java	Tue Jun 29 18:31:46 2010 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
-package com.nokia.carbide.trk.support.connection;
-
-import com.nokia.carbide.remoteconnections.interfaces.IConnectionType;
-
-import java.util.Map;
-
-public class TCFConnection extends TCPIPConnection {
-
-	public TCFConnection(IConnectionType connectionType, Map<String, String> settings) {
-		super(connectionType, settings);
-	}
-
-	
-}
--- a/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/connection/TCFConnectionFactory.java	Tue Jun 29 18:31:46 2010 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,143 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
-package com.nokia.carbide.trk.support.connection;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.swt.widgets.Composite;
-
-import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator;
-import com.nokia.carbide.remoteconnections.interfaces.IConnection;
-import com.nokia.carbide.remoteconnections.interfaces.IConnectionType;
-import com.nokia.carbide.remoteconnections.interfaces.IService;
-import com.nokia.carbide.remoteconnections.interfaces.IService2;
-
-public class TCFConnectionFactory extends TCPIPConnectionFactory {
-
-	private static final int MIN_DYN_PORT_NUM = 49152;
-	private static final int MAX_DYN_PORT_NUM = 65535;
-	private Map<String, Integer> serviceIdToPortMappings;
-	private TableViewer viewer;
-	
-	public TCFConnectionFactory(IConnectionType connectionType) {
-		super(connectionType);
-		serviceIdToPortMappings = new HashMap<String, Integer>();
-		initializePortMappings();
-	}
-
-	private void initializePortMappings() {
-		Collection<IService> services = RemoteConnectionsActivator.getConnectionTypeProvider().getCompatibleServices(connectionType);
-		for (IService service : services) {
-			IService2 service2 = service instanceof IService2 ? (IService2) service : null;
-			Integer defaultPort = null;
-			if (service2 != null) {
-				try {
-					String defaultPortString = service2.getDefaults().get(IP_PORT);
-					defaultPort = Integer.valueOf(defaultPortString);
-				} catch (NumberFormatException e) {
-					// if it doesn't parse as an int, we ignore it and provide a dynamic default
-				}
-			}
-			if (defaultPort != null)
-				serviceIdToPortMappings.put(service.getIdentifier(), defaultPort);
-		}
-		for (IService service : services) {
-			String identifier = service.getIdentifier();
-			if (!serviceIdToPortMappings.containsKey(identifier))
-				serviceIdToPortMappings.put(identifier, getUnusedDynamicDefault());
-		}
-		
-	}
-
-	private Integer getUnusedDynamicDefault() {
-		for (Integer val = MIN_DYN_PORT_NUM; val < MAX_DYN_PORT_NUM; val++) {
-			if (!serviceIdToPortMappings.containsValue(val))
-				return val;
-		}
-		return -1; // should never get here!!!
-	}
-
-	@Override
-	public IConnection createConnection(Map<String, String> settings) {
-		if (settings == null)
-			settings = getSettingsFromUI();
-		return new TCFConnection(connectionType, settings);
-	}
-
-	@Override
-	public void createEditingUI(Composite parent, IValidationErrorReporter errorReporter, Map<String, String> initialSettings) {
-		super.createEditingUI(parent, errorReporter, initialSettings);
-/*		updatePortMappings(initialSettings);
-		Label label = new Label(composite, SWT.NONE);
-		GridDataFactory.defaultsFor(label).span(2, 1).applyTo(label);
-		label.setText(Messages.getString("TCPIPPortMappingConnectionFactory.ViewerLabel")); //$NON-NLS-1$
-	
-		viewer = new TableViewer(composite, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION);
-		viewer.setContentProvider(new ArrayContentProvider());
-		
-		TableViewerColumn serviceColumn = new TableViewerColumn(viewer, SWT.LEFT);
-		serviceColumn.getColumn().setText(Messages.getString("TCPIPPortMappingConnectionFactory.ServiceHeader")); //$NON-NLS-1$
-		
-		TableViewerColumn portColumn = new TableViewerColumn(viewer, SWT.RIGHT);
-		portColumn.getColumn().setText(Messages.getString("TCPIPPortMappingConnectionFactory.PortHeader")); //$NON-NLS-1$
-		portColumn.setEditingSupport(new PortColumnEditingSupport(viewer));
-		
-		viewer.setLabelProvider(new TableLabelProvider());
-		viewer.setInput(serviceIdToPortMappings.keySet());
-		
-		Table table = viewer.getTable();
-		table.setHeaderVisible(true);
-		GridDataFactory.defaultsFor(table).span(2, 1).hint(SWT.DEFAULT, 60).grab(true, false).applyTo(table);
-		table.setToolTipText(Messages.getString("TCPIPPortMappingConnectionFactory.ViewerTooltip")); //$NON-NLS-1$
-		table.setData(UID, "TCPIPPortMappingConnectionFactory.table"); //$NON-NLS-1$
-		table.setData("viewer", viewer); //$NON-NLS-1$
-		packColumns();
-*/	}
-
-	private Integer getValidValue(String value) {
-		try {
-			int intVal = Integer.parseInt(value);
-			if (intVal < 0)
-				return new Integer(0);
-			else if (intVal > MAX_DYN_PORT_NUM)
-				return new Integer(MAX_DYN_PORT_NUM);
-			else
-				return new Integer(intVal);
-		} catch (Exception e) {
-		}
-		return null;
-	}
-
-	@Override
-	public Map<String, String> getSettingsFromUI() {
-		Map<String, String> settings = super.getSettingsFromUI();
-		addMappings(settings);
-		return settings;
-	}
-
-	private void addMappings(Map<String, String> settings) {
-		for (String serviceId : serviceIdToPortMappings.keySet()) {
-			settings.put(serviceId, String.valueOf(serviceIdToPortMappings.get(serviceId).intValue()));
-		}
-		settings.remove(IP_PORT);
-	}
-
-}
--- a/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/connection/TCFConnectionType.java	Tue Jun 29 18:31:46 2010 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
-
-package com.nokia.carbide.trk.support.connection;
-
-import com.nokia.carbide.remoteconnections.interfaces.IConnectionFactory;
-import com.nokia.carbide.remoteconnections.interfaces.IConnectionType;
-import com.nokia.carbide.trk.support.Messages;
-
-/**
- * Implementation of IConnectionType for TCP/IP connections
- */
-public class TCFConnectionType implements IConnectionType {
-
-	public static final String ID = "com.nokia.carbide.connection.TCFConnectionType"; //$NON-NLS-1$
-
-	public IConnectionFactory getConnectionFactory() {
-		return new TCFConnectionFactory(this);
-	}
-
-	public String getDescription() {
-		return Messages.getString("TCFConnectionType.Desc"); //$NON-NLS-1$
-	}
-
-	public String getDisplayName() {
-		return Messages.getString("TCFConnectionType.Label"); //$NON-NLS-1$
-	}
-
-	public String getHelpContext() {
-		return null;
-	}
-
-	public String getIdentifier() {
-		return ID;
-	}
-
-}
--- a/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/connection/TCFUSBConnection.java	Tue Jun 29 18:31:46 2010 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
-package com.nokia.carbide.trk.support.connection;
-
-import com.nokia.carbide.remoteconnections.interfaces.IConnectionType;
-
-import java.util.Map;
-
-public class TCFUSBConnection extends TCPIPConnection {
-
-	public TCFUSBConnection(IConnectionType connectionType, Map<String, String> settings) {
-		super(connectionType, settings);
-	}
-
-	
-}
--- a/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/connection/TCFUSBConnectionType.java	Tue Jun 29 18:31:46 2010 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
-
-package com.nokia.carbide.trk.support.connection;
-
-import com.nokia.carbide.remoteconnections.interfaces.IConnectionFactory;
-import com.nokia.carbide.trk.support.Messages;
-
-/**
- * Implementation of IConnectionType for USB TCF connections.  This also uses Nokia TCF but 
- * is given a unique identifier for now so we can debug it differently.
- */
-public class TCFUSBConnectionType implements IUSBConnectionType {
-
-	public static final String ID = "com.nokia.carbide.connection.TCFUSBConnectionType"; //$NON-NLS-1$
-
-	public IConnectionFactory getConnectionFactory() {
-		return new SerialConnectionFactory(this, true);
-	}
-
-	public String getDescription() {
-		return Messages.getString("TCFUSBConnectionType.Desc"); //$NON-NLS-1$
-	}
-
-	public String getDisplayName() {
-		return Messages.getString("TCFUSBConnectionType.Label"); //$NON-NLS-1$
-	}
-
-	public String getHelpContext() {
-		return null;
-	}
-
-	public String getIdentifier() {
-		return ID;
-	}
-
-}
--- a/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/messages.properties	Tue Jun 29 18:31:46 2010 -0500
+++ b/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/messages.properties	Wed Jun 30 14:00:29 2010 -0500
@@ -60,8 +60,4 @@
 TracingService.Label=Tracing
 USBConnectionType.Desc=USB serial port connection settings
 USBConnectionType.Label=USB
-TCFConnectionType.Desc=TCP/IP settings
-TCFConnectionType.Label=TCP/IP
-TCFUSBConnectionType.Desc=USB serial port connection settings\n(This is a temporary variant used to target the TCF debug agent on the device.)
-TCFUSBConnectionType.Label=USB (TCF)
 
--- a/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/ConnectedServiceFactory.java	Tue Jun 29 18:31:46 2010 -0500
+++ b/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/ConnectedServiceFactory.java	Wed Jun 30 14:00:29 2010 -0500
@@ -29,9 +29,6 @@
 import com.nokia.carbide.remoteconnections.interfaces.IService;
 import com.nokia.carbide.trk.support.connection.SerialBTConnectionType;
 import com.nokia.carbide.trk.support.connection.SerialConnectionType;
-import com.nokia.carbide.trk.support.connection.TCFConnection;
-import com.nokia.carbide.trk.support.connection.TCFConnectionType;
-import com.nokia.carbide.trk.support.connection.TCFUSBConnectionType;
 import com.nokia.carbide.trk.support.connection.USBConnectionType;
 import com.nokia.cpp.internal.api.utils.core.HostOS;
 
@@ -52,11 +49,10 @@
 		}
 		else if (service instanceof TRKService &&
 				isCompatibleConnection(getCompatibleTRKConnectionTypeIds(), connection)) {
-			if (HostOS.IS_UNIX || connection instanceof TCFConnection)
+			if (HostOS.IS_UNIX)
 				return new RemoteConnectedService(service);	// TODO: not ported
 			return new TRKConnectedService(service, (AbstractSynchronizedConnection) connection);
 		}
-		
 		return null;
 	}
 	
@@ -73,20 +69,17 @@
 	private Collection<String> getCompatibleTracingConnectionTypeIds() {
 		return Arrays.asList(new String[] {
 				USBConnectionType.ID,
-				TCFUSBConnectionType.ID,
 		});
 	}
 	
 	private Collection<String> getCompatibleTRKConnectionTypeIds() {
 		return Arrays.asList(new String[] {
 				SerialConnectionType.ID,
-				TCFConnectionType.ID,
 				SerialBTConnectionType.ID,
 				USBConnectionType.ID,
-				TCFUSBConnectionType.ID,
 				}); 
 	}
-
+	
 	/* (non-Javadoc)
 	 * @see com.nokia.carbide.remoteconnections.interfaces.IConnectedServiceFactory#getCompatibleConnectionTypeIds(com.nokia.carbide.remoteconnections.interfaces.IService)
 	 */
--- a/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/TRKService.java	Tue Jun 29 18:31:46 2010 -0500
+++ b/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/TRKService.java	Wed Jun 30 14:00:29 2010 -0500
@@ -46,7 +46,6 @@
 				SerialBTConnectionType.ID,
 				TCPIPConnectionType.ID,
 				USBConnectionType.ID,
-				TCFUSBConnectionType.ID
 				}); 
 	}
 
--- a/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/TracingService.java	Tue Jun 29 18:31:46 2010 -0500
+++ b/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/TracingService.java	Wed Jun 30 14:00:29 2010 -0500
@@ -20,7 +20,6 @@
 
 import com.nokia.carbide.remoteconnections.interfaces.*;
 import com.nokia.carbide.trk.support.Messages;
-import com.nokia.carbide.trk.support.connection.TCFUSBConnectionType;
 import com.nokia.carbide.trk.support.connection.TCPIPConnectionType;
 import com.nokia.carbide.trk.support.connection.USBConnectionType;
 import com.nokia.cpp.internal.api.utils.core.Check;
@@ -48,7 +47,6 @@
 		return Arrays.asList(new String[] {
 				TCPIPConnectionType.ID,
 				USBConnectionType.ID,
-				TCFUSBConnectionType.ID,
 		});
 	}
 
--- a/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/status/ConnectionStatusReconciler.java	Tue Jun 29 18:31:46 2010 -0500
+++ b/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/status/ConnectionStatusReconciler.java	Wed Jun 30 14:00:29 2010 -0500
@@ -37,7 +37,6 @@
 import com.nokia.carbide.remoteconnections.internal.api.IConnection2.IConnectionStatus;
 import com.nokia.carbide.remoteconnections.internal.api.IConnection2.IConnectionStatus.EConnectionStatus;
 import com.nokia.carbide.trk.support.Messages;
-import com.nokia.carbide.trk.support.connection.TCFUSBConnectionType;
 import com.nokia.carbide.trk.support.connection.USBConnectionType;
 import com.nokia.carbide.trk.support.service.TRKConnectedService;
 import com.nokia.carbide.trk.support.service.TracingConnectedService;
@@ -205,8 +204,7 @@
 	
 	private boolean canBeSetToCurrent(IConnection connection) {
 		// USB connections for now
-		return USBConnectionType.ID.equals(connection.getConnectionType().getIdentifier())
-		|| TCFUSBConnectionType.ID.equals(connection.getConnectionType().getIdentifier());
+		return USBConnectionType.ID.equals(connection.getConnectionType().getIdentifier());
 	}
 
 	private void reconcileStatus(IConnection connection) {