Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: b80e9a87a477a3202b7d608744a630c7e26d718e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*******************************************************************************
 * Copyright (c) 2008, 2012 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 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * Contributors:
 *     Wind River Systems - initial API and implementation
 *******************************************************************************/
package org.eclipse.tcf.core;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

import org.eclipse.tcf.internal.core.TransportManager;
import org.eclipse.tcf.protocol.IChannel;
import org.eclipse.tcf.protocol.IPeer;

/**
 * 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 {

    protected final Map<String, String> ro_attrs;
    /**
     * Attributes
     */
    protected final Map<String, String> rw_attrs;

    public TransientPeer(Map<String,String> attrs) {
        rw_attrs = new HashMap<String,String>(attrs);
        ro_attrs = Collections.unmodifiableMap(rw_attrs);
    }

    public Map<String, String> getAttributes() {
        return ro_attrs;
    }

    public String getID() {
        return ro_attrs.get(ATTR_ID);
    }

    public String getServiceManagerID() {
        return ro_attrs.get(ATTR_SERVICE_MANGER_ID);
    }

    public String getAgentID() {
        return ro_attrs.get(ATTR_AGENT_ID);
    }

    public String getName() {
        return ro_attrs.get(ATTR_NAME);
    }

    public String getOSName() {
        return ro_attrs.get(ATTR_OS_NAME);
    }

    public String getUserName() {
        return ro_attrs.get(ATTR_USER_NAME);
    }

    public String getTransportName() {
        return ro_attrs.get(ATTR_TRANSPORT_NAME);
    }

    public IChannel openChannel() {
        return TransportManager.openChannel(this);
    }
}

Back to the top