Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2013-03-20 10:56:31 -0400
committerUwe Stieber2013-03-20 10:56:31 -0400
commit928a2327a2cfa58f3e14fbf564dc981aff5d9ef4 (patch)
treeec74c8733ada69958fed809e9910469473832081 /plugins
parent1c586eeb95cda1eca90e5d1df89fb7007aae5c43 (diff)
downloadorg.eclipse.tcf-928a2327a2cfa58f3e14fbf564dc981aff5d9ef4.tar.gz
org.eclipse.tcf-928a2327a2cfa58f3e14fbf564dc981aff5d9ef4.tar.xz
org.eclipse.tcf-928a2327a2cfa58f3e14fbf564dc981aff5d9ef4.zip
Locator: Added getAgentID() to ILocator (see also Bug 402644)
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/local/LocatorService.java4
-rw-r--r--plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/remote/LocatorProxy.java16
-rw-r--r--plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/services/ILocator.java12
3 files changed, 31 insertions, 1 deletions
diff --git a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/local/LocatorService.java b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/local/LocatorService.java
index 91dfcf231..9912d4d29 100644
--- a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/local/LocatorService.java
+++ b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/local/LocatorService.java
@@ -1208,6 +1208,10 @@ public class LocatorService implements ILocator {
throw new Error("Channel sync cannot be done on local peer");
}
+ public IToken getAgentID(DoneGetAgentID done) {
+ throw new Error("Channel get agent ID cannot be done on local peer");
+ }
+
public void addListener(LocatorListener listener) {
assert listener != null;
assert Protocol.isDispatchThread();
diff --git a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/remote/LocatorProxy.java b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/remote/LocatorProxy.java
index 293567fad..7817d81e7 100644
--- a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/remote/LocatorProxy.java
+++ b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/remote/LocatorProxy.java
@@ -25,7 +25,6 @@ import org.eclipse.tcf.protocol.JSON;
import org.eclipse.tcf.protocol.Protocol;
import org.eclipse.tcf.services.ILocator;
-
public class LocatorProxy implements ILocator {
private final IChannel channel;
@@ -176,6 +175,21 @@ public class LocatorProxy implements ILocator {
}
}.token;
}
+
+ public IToken getAgentID(final DoneGetAgentID done) {
+ return new Command(channel, this, "getAgentID", null) {
+ @Override
+ public void done(Exception error, Object[] args) {
+ String agentID = null;
+ if (error == null) {
+ assert args.length == 2;
+ error = toError(args[0]);
+ if (args[1] instanceof String) agentID = (String)args[1];
+ }
+ done.doneGetAgentID(token, error, agentID);
+ }
+ }.token;
+ }
public void addListener(LocatorListener listener) {
listeners.add(listener);
diff --git a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/services/ILocator.java b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/services/ILocator.java
index 3cf2f561d..afbd52a88 100644
--- a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/services/ILocator.java
+++ b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/services/ILocator.java
@@ -98,6 +98,18 @@ public interface ILocator extends IService {
interface DoneSync {
void doneSync(IToken token);
}
+
+ /**
+ * Get agent ID of the agent providing the locator service.
+ * <p>
+ * The agent ID can be used to identify the agent among all the peers
+ * returned by {@link #getPeers()}.
+ */
+ IToken getAgentID(DoneGetAgentID done);
+
+ interface DoneGetAgentID {
+ void doneGetAgentID(IToken token, Exception error, String agentID);
+ }
/**
* Add a listener for ILocator service events.

Back to the top