connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/interfaces/AbstractSynchronizedConnection.java
equal
deleted
inserted
replaced
17 |
17 |
18 |
18 |
19 package com.nokia.carbide.remoteconnections.interfaces; |
19 package com.nokia.carbide.remoteconnections.interfaces; |
20 |
20 |
21 import java.util.Map; |
21 import java.util.Map; |
|
22 |
|
23 import com.nokia.carbide.remoteconnections.Messages; |
|
24 import com.nokia.carbide.remoteconnections.internal.api.IConnection2.IConnectionStatus.EConnectionStatus; |
22 |
25 |
23 /** |
26 /** |
24 * Abstract base class providing implementation of in-use semantics of IConnection |
27 * Abstract base class providing implementation of in-use semantics of IConnection |
25 * using a counted map of potential resource strings and implements |
28 * using a counted map of potential resource strings and implements |
26 * {@link IConnection#useConnection(boolean)} allowing external clients to wait |
29 * {@link IConnection#useConnection(boolean)} allowing external clients to wait |
73 } |
76 } |
74 } |
77 } |
75 } |
78 } |
76 } |
79 } |
77 |
80 |
|
81 private void setStatus(boolean inUse) { |
|
82 if (inUse) { |
|
83 String label = Messages.getString("AbstractSynchronizedConnection.InUseLabel"); //$NON-NLS-1$ |
|
84 String desc = Messages.getString("AbstractSynchronizedConnection.InUseDesc"); //$NON-NLS-1$ |
|
85 setStatus(new ConnectionStatus(EConnectionStatus.IN_USE, label, desc)); |
|
86 } |
|
87 else { |
|
88 setStatus(new ConnectionStatus(EConnectionStatus.NONE, "", "")); //$NON-NLS-1$ //$NON-NLS-2$ |
|
89 } |
|
90 } |
|
91 |
78 public void setServiceTestingAndInUse(boolean value) { |
92 public void setServiceTestingAndInUse(boolean value) { |
79 synchronized (testingMutex) { |
93 synchronized (testingMutex) { |
80 testing = value; |
94 testing = value; |
81 setInUse(value); |
95 setInUse(value); |
82 } |
96 } |
97 } catch (InterruptedException e) { |
111 } catch (InterruptedException e) { |
98 } |
112 } |
99 } |
113 } |
100 } |
114 } |
101 setInUse(use); |
115 setInUse(use); |
|
116 if (!isDynamic()) |
|
117 setStatus(use); |
102 } |
118 } |
103 |
119 |
104 public Object getCurrentResource() { |
120 public Object getCurrentResource() { |
105 return getCurrentResourceString(); |
121 return getCurrentResourceString(); |
106 } |
122 } |