modify IConnectionsManager and IClientServiceSiteUI2 apis + document in relnotes
authordadubrow
Wed, 13 Jan 2010 09:46:29 -0600
changeset 759 d4aeef4e0f16
parent 758 c3cf3704d340
child 760 f83ff2d4e9d2
modify IConnectionsManager and IClientServiceSiteUI2 apis + document in relnotes
carbidesdk/com.nokia.carbide.cpp.sdk.doc.user/html/reference/api_Change_Notes.htm
connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/interfaces/IClientServiceSiteUI2.java
connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/interfaces/IConnectionsManager.java
connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/registry/Registry.java
debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/TRKConnectionWizardPage.java
--- a/carbidesdk/com.nokia.carbide.cpp.sdk.doc.user/html/reference/api_Change_Notes.htm	Wed Jan 13 09:44:43 2010 -0600
+++ b/carbidesdk/com.nokia.carbide.cpp.sdk.doc.user/html/reference/api_Change_Notes.htm	Wed Jan 13 09:46:29 2010 -0600
@@ -104,7 +104,12 @@
 <p>Since Carbide 3.0.0</p>
 <ul>
 	<li>IConnectionsManager was updated to indicate it is not intended to be implemented by clients.
-	<li>Added several new methods to support automated connection/device discovery agents.</li>
+	<li>Added several new methods to support automated connection/device discovery agents and default connections.</li>
+	<li>Deprecated IClientServiceSiteUI and adding new IClientServiceSiteUI2 to support concept of default connection
+	<ul>
+		<li>getSelectedConnection() and selectConnection() now use connection ids rather than connection objects
+		<li>Exposing new selection status to allow reporting when default connection is not supported by client service
+	</ul>
 </ul>
 
 
--- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/interfaces/IClientServiceSiteUI2.java	Wed Jan 13 09:44:43 2010 -0600
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/interfaces/IClientServiceSiteUI2.java	Wed Jan 13 09:46:29 2010 -0600
@@ -65,13 +65,6 @@
 	String getSelectedConnection();
 	
 	/**
-	 * Get the display name of the selected connection id
-	 * @param connection the connection id
-	 * @return String, never <code>null</code>
-	 */
-	String getConnectionDisplayName(String connection);
-	
-	/**
 	 * Adds a listener to the client site UI
 	 * @param listener IListener
 	 */
--- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/interfaces/IConnectionsManager.java	Wed Jan 13 09:44:43 2010 -0600
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/interfaces/IConnectionsManager.java	Wed Jan 13 09:46:29 2010 -0600
@@ -194,6 +194,16 @@
 	IConnection ensureConnection(String connectionId, IService service) throws CoreException;
 	
 	/**
+	 * Returns a connection from an id (including the default connection id) or null if none found.
+	 * @param connectionId String
+	 * @param service IService
+	 * @return IConnection
+	 * @throws CoreException
+	 * @since 3.0
+	 */
+	IConnection findConnection(String connectionId);
+	
+	/**
 	 * Sets a dynamic connection as disconnected. Is no-op on user generated connections.
 	 * If a dynamic connection is disconnected, it is transitioned to a disconnected state while it
 	 * is in use by some client service, and is eventually removed from the system once it is 
--- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/registry/Registry.java	Wed Jan 13 09:44:43 2010 -0600
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/registry/Registry.java	Wed Jan 13 09:46:29 2010 -0600
@@ -329,7 +329,7 @@
 	
 	private void ensureUniqueId(IConnection connection) {
 		String id = connection.getIdentifier();
-		if (id == null || id.length() == 0 || findConnectionById(id) != null)
+		if (id == null || id.length() == 0 || findConnection(id) != null)
 			connection.setIdentifier(getUniqueConnectionId());
 	}
 	
@@ -337,9 +337,12 @@
 		return UUID.randomUUID().toString();
 	}
 	
-	public IConnection findConnectionById(String id) {
+	public IConnection findConnection(String connectionId) {
+		if (DEFAULT_CONNECTION_ID.equals(connectionId))
+			return getDefaultConnection();
+		
 		for (IConnection connection : connectionToConnectedServices.keySet()) {
-			if (connection.getIdentifier().equals(id)) {
+			if (connection.getIdentifier().equals(connectionId)) {
 				return connection;
 			}
 		}
@@ -520,12 +523,7 @@
 	
 	public IConnection ensureConnection(String id, IService service) throws CoreException {
 		Check.checkArg(service);
-		IConnection connection;
-		if (DEFAULT_CONNECTION_ID.equals(id)) {
-			connection = getDefaultConnection();
-		} else {
-			connection = findConnectionById(id);
-		}
+		IConnection connection = findConnection(id);
 		if (!isCompatibleConnection(connection, service)) {
 			// TODO ask user to connect a device or cancel
 			throw new CoreException(
--- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/TRKConnectionWizardPage.java	Wed Jan 13 09:44:43 2010 -0600
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/TRKConnectionWizardPage.java	Wed Jan 13 09:46:29 2010 -0600
@@ -19,6 +19,7 @@
 import com.freescale.cdt.debug.cw.core.RemoteConnectionsTRKHelper;
 import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator;
 import com.nokia.carbide.remoteconnections.interfaces.IClientServiceSiteUI2;
+import com.nokia.carbide.remoteconnections.interfaces.IConnection;
 import com.nokia.carbide.remoteconnections.interfaces.IClientServiceSiteUI2.IListener;
 import com.nokia.cdt.internal.debug.launch.LaunchPlugin;
 import com.nokia.cpp.internal.api.utils.core.Check;
@@ -38,7 +39,7 @@
     
 	private final ISummaryTextItemContainer summaryTextItemContainer;
 	private IClientServiceSiteUI2 clientSiteUI;
-	private String connection;
+	private String connectionId;
 	
     
     public TRKConnectionWizardPage(ISummaryTextItemContainer summaryTextItemContainer) {
@@ -72,17 +73,18 @@
     }
     
     void updateConfiguration(ILaunchConfigurationWorkingCopy config) {
-		if (connection != null) {
-			config.setAttribute(RemoteConnectionsTRKHelper.CONNECTION_ATTRIBUTE, connection);
+		if (connectionId != null) {
+			config.setAttribute(RemoteConnectionsTRKHelper.CONNECTION_ATTRIBUTE, connectionId);
 		}
     }
 
     public void setVisible(boolean visible) {
     	super.setVisible(visible);
+    	IConnection connection = RemoteConnectionsActivator.getConnectionsManager().findConnection(connectionId);
     	if (!visible && connection != null) {
     		summaryTextItemContainer.putSummaryTextItem("Connection", //$NON-NLS-1$
     				MessageFormat.format("{0} {1}", Messages.getString("TRKConnectionWizardPage.ConnectionSummaryLabel"), //$NON-NLS-1$ //$NON-NLS-2$
-    						clientSiteUI.getConnectionDisplayName(connection)));
+    						connection.getDisplayName()));
     	}
     }
     
@@ -101,7 +103,7 @@
 			}
 		}
 		else {
-			connection = clientSiteUI.getSelectedConnection();
+			connectionId = clientSiteUI.getSelectedConnection();
 		}
     }