Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: ef64db1418b4a0b4da5be71dff9e7b2b94464a6c (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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/*******************************************************************************
 * Copyright (c) 2015 Composent, Inc. 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: Scott Lewis - initial API and implementation
 ******************************************************************************/
package org.eclipse.ecf.remoteserviceadmin.ui.endpoint.model;

import org.eclipse.ecf.osgi.services.remoteserviceadmin.EndpointDescription;
import org.eclipse.ecf.osgi.services.remoteserviceadmin.RemoteServiceAdmin.ImportReference;
import org.eclipse.ecf.osgi.services.remoteserviceadmin.RemoteServiceAdmin.ImportRegistration;

/**
 * @since 3.3
 */
public class EndpointNode extends AbstractEndpointNode {

	private EndpointDescription endpointDescription;
	private ImportReference importReference;

	public EndpointNode(EndpointDescription ed) {
		this.endpointDescription = ed;
	}

	public EndpointNode(EndpointDescription ed, ImportRegistrationNode irn) {
		this.endpointDescription = ed;
		this.importReference = (ImportReference) irn.getImportRegistration().getImportReference();
	}

	/**
	 * @since 3.3
	 */
	public EndpointNode(EndpointDescription ed, ImportReference ir) {
		this.endpointDescription = ed;
		this.importReference = ir;
	}

	public boolean equals(Object other) {
		if (other instanceof EndpointNode) {
			EndpointNode o = (EndpointNode) other;
			return endpointDescription.getId().equals(o.endpointDescription.getId());
		}
		return false;
	}

	public int hashCode() {
		return endpointDescription.getId().hashCode();
	}

	public EndpointDescription getEndpointDescription() {
		return endpointDescription;
	}

	@Deprecated
	public ImportRegistrationNode getImportReg() {
		return null;
	}

	@Deprecated
	public ImportRegistration getImportRegistration() {
		return null;
	}

	/**
	 * @since 3.3
	 */
	public ImportReference getImportReference() {
		return importReference;
	}

	public boolean isImported() {
		return getImportReference() != null;
	}

	public void setEndpointDescription(EndpointDescription ed) {
		this.endpointDescription = ed;
	}

	/**
	 * @since 3.3
	 */
	public void setImportReference(ImportReference iref) {
		this.importReference = iref;
	}

	@Deprecated
	public void setImportReg(ImportRegistrationNode ir) {

	}

}

Back to the top