Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/internal/tcf/services/remote/LocatorProxy.java42
-rw-r--r--plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/tcf/core/AbstractChannel.java2
-rw-r--r--plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/tcf/core/AbstractPeer.java3
-rw-r--r--plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/tcf/core/ServerTCP.java45
-rw-r--r--plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/tcf/core/TransientPeer.java66
5 files changed, 73 insertions, 85 deletions
diff --git a/plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/internal/tcf/services/remote/LocatorProxy.java b/plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/internal/tcf/services/remote/LocatorProxy.java
index 94ec1ff91..d5be57e2c 100644
--- a/plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/internal/tcf/services/remote/LocatorProxy.java
+++ b/plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/internal/tcf/services/remote/LocatorProxy.java
@@ -17,6 +17,7 @@ import java.util.HashMap;
import java.util.Map;
import org.eclipse.tm.tcf.core.Command;
+import org.eclipse.tm.tcf.core.TransientPeer;
import org.eclipse.tm.tcf.protocol.IChannel;
import org.eclipse.tm.tcf.protocol.IPeer;
import org.eclipse.tm.tcf.protocol.IToken;
@@ -33,50 +34,13 @@ public class LocatorProxy implements ILocator {
private boolean get_peers_done = false;
- private class Peer implements IPeer {
+ private class Peer extends TransientPeer {
private final IPeer parent;
- private final Map<String, String> attrs;
-
Peer(IPeer parent, Map<String,String> attrs) {
+ super(attrs);
this.parent = parent;
- this.attrs = attrs;
- }
-
- public Map<String, String> getAttributes() {
- assert Protocol.isDispatchThread();
- return attrs;
- }
-
- public String getID() {
- assert Protocol.isDispatchThread();
- return attrs.get(ATTR_ID);
- }
-
- public String getServiceManagerID() {
- assert Protocol.isDispatchThread();
- return attrs.get(ATTR_SERVICE_MANGER_ID);
- }
-
- public String getAgentID() {
- assert Protocol.isDispatchThread();
- return attrs.get(ATTR_AGENT_ID);
- }
-
- public String getName() {
- assert Protocol.isDispatchThread();
- return attrs.get(ATTR_NAME);
- }
-
- public String getOSName() {
- assert Protocol.isDispatchThread();
- return attrs.get(ATTR_OS_NAME);
- }
-
- public String getTransportName() {
- assert Protocol.isDispatchThread();
- return attrs.get(ATTR_TRANSPORT_NAME);
}
public IChannel openChannel() {
diff --git a/plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/tcf/core/AbstractChannel.java b/plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/tcf/core/AbstractChannel.java
index 14cb5af62..49135a8ac 100644
--- a/plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/tcf/core/AbstractChannel.java
+++ b/plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/tcf/core/AbstractChannel.java
@@ -474,7 +474,7 @@ public abstract class AbstractChannel implements IChannel {
if (state != STATE_OPENNING) return;
if (x != null) terminate(x);
final IPeer parent = remote_peer;
- remote_peer = new AbstractPeer(peer_attrs) {
+ remote_peer = new TransientPeer(peer_attrs) {
public IChannel openChannel() {
IChannel c = parent.openChannel();
c.redirect(peer_attrs);
diff --git a/plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/tcf/core/AbstractPeer.java b/plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/tcf/core/AbstractPeer.java
index 9423b9de9..4b2541968 100644
--- a/plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/tcf/core/AbstractPeer.java
+++ b/plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/tcf/core/AbstractPeer.java
@@ -27,6 +27,9 @@ import org.eclipse.tm.tcf.services.ILocator.LocatorListener;
/**
* Abstract implementation of IPeer interface.
+ * Objects of this class are stored in Locator service peer table.
+ * The class implements sending notification events to Locator listeners.
+ * See TransientPeer for IPeer objects that are not stored in the Locator table.
*/
public class AbstractPeer implements IPeer {
diff --git a/plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/tcf/core/ServerTCP.java b/plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/tcf/core/ServerTCP.java
index 6b85a5842..4700c0cd5 100644
--- a/plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/tcf/core/ServerTCP.java
+++ b/plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/tcf/core/ServerTCP.java
@@ -17,14 +17,12 @@ import java.net.NetworkInterface;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.eclipse.tm.internal.tcf.core.ServiceManager;
-import org.eclipse.tm.tcf.protocol.IChannel;
import org.eclipse.tm.tcf.protocol.IPeer;
import org.eclipse.tm.tcf.protocol.Protocol;
@@ -42,49 +40,6 @@ public class ServerTCP extends ServerSocket {
}
}
- private static class TransientPeer implements IPeer {
-
- private final Map<String,String> attrs;
-
- TransientPeer(Map<String,String> attrs) {
- this.attrs = Collections.unmodifiableMap(attrs);
- }
-
- public Map<String, String> getAttributes() {
- return attrs;
- }
-
- public String getID() {
- return attrs.get(ATTR_ID);
- }
-
- public String getServiceManagerID() {
- assert Protocol.isDispatchThread();
- return attrs.get(ATTR_SERVICE_MANGER_ID);
- }
-
- public String getAgentID() {
- assert Protocol.isDispatchThread();
- return attrs.get(ATTR_AGENT_ID);
- }
-
- public String getName() {
- return attrs.get(ATTR_NAME);
- }
-
- public String getOSName() {
- return attrs.get(ATTR_OS_NAME);
- }
-
- public String getTransportName() {
- return attrs.get(ATTR_TRANSPORT_NAME);
- }
-
- public IChannel openChannel() {
- throw new Error("Cannot open channel for transient peer");
- }
- }
-
private final String name;
private List<ServerPeer> peers;
private Thread thread;
diff --git a/plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/tcf/core/TransientPeer.java b/plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/tcf/core/TransientPeer.java
new file mode 100644
index 000000000..31669feb9
--- /dev/null
+++ b/plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/tcf/core/TransientPeer.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Wind River Systems, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tm.tcf.core;
+
+import java.util.Collections;
+import java.util.Map;
+
+import org.eclipse.tm.tcf.protocol.IChannel;
+import org.eclipse.tm.tcf.protocol.IPeer;
+import org.eclipse.tm.tcf.protocol.Protocol;
+
+/**
+ * Transient implementation of IPeer interface.
+ * Objects of this class are not tracked by Locator service.
+ * See AbstractPeer for IPeer objects that should go into the Locator table.
+ */
+public class TransientPeer implements IPeer {
+
+ private final Map<String,String> attrs;
+
+ public TransientPeer(Map<String,String> attrs) {
+ this.attrs = Collections.unmodifiableMap(attrs);
+ }
+
+ public Map<String, String> getAttributes() {
+ return attrs;
+ }
+
+ public String getID() {
+ return attrs.get(ATTR_ID);
+ }
+
+ public String getServiceManagerID() {
+ assert Protocol.isDispatchThread();
+ return attrs.get(ATTR_SERVICE_MANGER_ID);
+ }
+
+ public String getAgentID() {
+ assert Protocol.isDispatchThread();
+ return attrs.get(ATTR_AGENT_ID);
+ }
+
+ public String getName() {
+ return attrs.get(ATTR_NAME);
+ }
+
+ public String getOSName() {
+ return attrs.get(ATTR_OS_NAME);
+ }
+
+ public String getTransportName() {
+ return attrs.get(ATTR_TRANSPORT_NAME);
+ }
+
+ public IChannel openChannel() {
+ throw new Error("Cannot open channel for transient peer");
+ }
+} \ No newline at end of file

Back to the top