bug 11181 RCL_2_4
authordadubrow
Tue, 27 Apr 2010 13:17:04 -0500
branchRCL_2_4
changeset 1305 68114c404585
parent 1300 dd0c4e59db51
child 1308 461196599a89
bug 11181
connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/interfaces/AbstractConnectedService2.java
connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/interfaces/AbstractSynchronizedConnection.java
connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/messages.properties
--- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/interfaces/AbstractConnectedService2.java	Tue Apr 27 11:57:26 2010 -0500
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/interfaces/AbstractConnectedService2.java	Tue Apr 27 13:17:04 2010 -0500
@@ -31,7 +31,6 @@
 import com.nokia.carbide.remoteconnections.interfaces.IConnectedService.IStatus.EStatus;
 import com.nokia.carbide.remoteconnections.internal.ServiceTester;
 import com.nokia.carbide.remoteconnections.internal.api.IConnectedService2;
-import com.nokia.carbide.remoteconnections.internal.api.IConnection2.IConnectionStatus;
 import com.nokia.cpp.internal.api.utils.core.Check;
 import com.nokia.cpp.internal.api.utils.core.ListenerList;
 import com.nokia.cpp.internal.api.utils.core.ObjectUtils;
@@ -88,20 +87,9 @@
 			this.shortDescription = shortDescription;
 			this.longDescription = longDescription;
 			fireStatusChanged();
-			if (!connection.isDynamic())
-				connection.setStatus(getInUseConnectionStatus(estatus));
 		}
 	}
 
-	private IConnectionStatus getInUseConnectionStatus(EStatus serviceStatus) {
-		String desc = ""; //$NON-NLS-1$
-		if (serviceStatus.equals(EStatus.IN_USE)) {
-			desc = Messages.getString("AbstractConnectedService2.InUseDesc"); //$NON-NLS-1$
-			return new AbstractConnection.ConnectionStatus(IConnectionStatus.EConnectionStatus.IN_USE, desc, desc);
-		} else
-			return new AbstractConnection.ConnectionStatus(IConnectionStatus.EConnectionStatus.NONE, desc, desc);
-	}
-
 	public static class TestResult {
 		public TestResult(EStatus estatus, String shortDescription, String longDescription) {
 			this.estatus = estatus;
--- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/interfaces/AbstractSynchronizedConnection.java	Tue Apr 27 11:57:26 2010 -0500
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/interfaces/AbstractSynchronizedConnection.java	Tue Apr 27 13:17:04 2010 -0500
@@ -20,6 +20,9 @@
 
 import java.util.Map;
 
+import com.nokia.carbide.remoteconnections.Messages;
+import com.nokia.carbide.remoteconnections.internal.api.IConnection2.IConnectionStatus.EConnectionStatus;
+
 /**
  * Abstract base class providing implementation of in-use semantics of IConnection
  * using a counted map of potential resource strings and implements 
@@ -75,6 +78,17 @@
 		}
 	}
 	
+	private void setStatus(boolean inUse) {
+		if (inUse) {
+			String label = Messages.getString("AbstractSynchronizedConnection.InUseLabel"); //$NON-NLS-1$
+			String desc = Messages.getString("AbstractSynchronizedConnection.InUseDesc"); //$NON-NLS-1$
+			setStatus(new ConnectionStatus(EConnectionStatus.IN_USE, label, desc));
+		}
+		else {
+			setStatus(new ConnectionStatus(EConnectionStatus.NONE, "", "")); //$NON-NLS-1$ //$NON-NLS-2$
+		}
+	}
+	
 	public void setServiceTestingAndInUse(boolean value) {
 		synchronized (testingMutex) {
 			testing = value;
@@ -99,6 +113,8 @@
 			}
 		}
 		setInUse(use);
+		if (!isDynamic())
+			setStatus(use);
 	}
 	
 	public Object getCurrentResource() {
--- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/messages.properties	Tue Apr 27 11:57:26 2010 -0500
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/messages.properties	Tue Apr 27 13:17:04 2010 -0500
@@ -1,10 +1,11 @@
 AbstractConnectedService.UserDisabledMessage=User disabled active status testing
 AbstractConnectedService.NoTestingLabel=Not testing service
-AbstractConnectedService2.InUseDesc=In Use
 AbstractImportExportPage.BrowseButtonLabel=Browse...
 AbstractImportExportPage.ConnectionColumnLabel=Connection
 AbstractImportExportPage.TypeColumnLabel=Type
 AbstractPackageInstallerProvider.DownloadingAgentJobLabel=Dowloading Remote Agent Installer
+AbstractSynchronizedConnection.InUseLabel=In use
+AbstractSynchronizedConnection.InUseDesc=At least one service is using this connection
 ClientServiceSiteUI.EditButtonLabel=Edit...
 ClientServiceSiteUI.NewButtonLabel=New...
 ClientServiceSiteUI.UseConnectionGroupLabel=Use connection