Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 9a910203c49791bdad943156c60da1f685943553 (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
75
76
/*******************************************************************************
 * Copyright (c) 2004 Composent, 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: Composent, Inc. - initial API and implementation
 ******************************************************************************/

package org.eclipse.ecf.discovery;

import java.io.Serializable;
import java.net.InetAddress;
import java.util.Map;

import org.eclipse.ecf.core.identity.ServiceID;

public class ServiceInfo implements IServiceInfo, Serializable {

	private static final long serialVersionUID = 1L;
	InetAddress addr = null;
	ServiceID serviceID;
	int port;
	int priority;
	int weight;
	Map properties;

	public ServiceInfo(InetAddress address, ServiceID id, int port,
			int priority, int weight, Map props) {
		this.addr = address;
		this.serviceID = id;
		this.port = port;
		this.priority = priority;
		this.weight = weight;
		this.properties = props;
	}

	public InetAddress getAddress() {
		return addr;
	}

	protected void setAddress(InetAddress address) {
		this.addr = address;
	}

	public ServiceID getServiceID() {
		return serviceID;
	}

	public int getPort() {
		return port;
	}

	public int getPriority() {
		return priority;
	}

	public int getWeight() {
		return weight;
	}

	public Map getProperties() {
		return properties;
	}
	public boolean isResolved() {
		return (addr == null);
	}
	public String toString() {
		StringBuffer buf = new StringBuffer("ServiceInfo[");
		buf.append("addr=").append(addr).append(";id=").append(serviceID).append(
				";port=").append(port).append(";priority=").append(priority)
				.append(";weight=").append(weight).append(";props=").append(
						properties).append("]");
		return buf.toString();
	}
}

Back to the top