summaryrefslogtreecommitdiffstats
blob: 9c351b5cf3c3682598b0fd72309993830ede9d7d (plain)
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
/*
 * Copyright (c) 2010 Isode Limited.
 * All rights reserved.
 * See the COPYING file for more information.
 */
/*
 * Copyright (c) 2015 Tarun Gupta.
 * Licensed under the simplified BSD license.
 * See Documentation/Licenses/BSD-simplified.txt for more information.
 */

package com.isode.stroke.elements;

import com.isode.stroke.base.NotNull;
import com.isode.stroke.jid.JID;
import com.isode.stroke.elements.Payload;
import java.util.Vector;

public class Bytestreams extends Payload {

	public class StreamHost {

		public String host;
		public JID jid;
		public int port;

		/**
		* Default Constructor.
		*/
		public StreamHost() {
			this("", new JID(), -1);
		}

		/**
		* StreamHost with single parameter, host.
		*/
		public StreamHost(String host) {
			this(host, new JID(), -1);
		}

		/**
		* StreamHost with two parameter, host and jid.
		*/
		public StreamHost(String host, JID jid) {
			this(host, jid, -1);
		}

		/**
		* StreamHost with three parameter, host, jid and port.
		*/
		public StreamHost(String host, JID jid, int port) {
			NotNull.exceptIfNull(host, "host");
			NotNull.exceptIfNull(jid, "jid");
			this.host = host;
			this.jid = jid;
			this.port = port;
		}

		/**
		* @return host, NotNull.
		*/
		public String getHost() {
			return host;
		}

		/**
		* @param host, NotNull.
		*/
		public void setHost(String host) {
			NotNull.exceptIfNull(host, "host");			
			this.host = host;
		}

		/**
		* @return jid, NotNull.
		*/
		public JID getJID() {
			return jid;
		}

		/**
		* @param jid, NotNull.
		*/
		public void setJID(JID jid) {
			NotNull.exceptIfNull(jid, "jid");
			this.jid = jid;
		}

		/**
		* @return port.
		*/
		public int getPort() {
			return port;
		}

		/**
		* @param port.
		*/
		public void setPort(int port) {
			this.port = port;
		}

	}

	private String id = "";
	JID usedStreamHost;
	Vector<StreamHost> streamHosts = new Vector<StreamHost>();

	/**
	* Default Constructor.
	*/
	public Bytestreams() {

	}

	/**
	* @return id, notnull.
	*/
	public String getStreamID() {
		return id;
	}

	/**
	* @param id, notnull.
	*/
	public void setStreamID(String id) {
		NotNull.exceptIfNull(id, "id");
		this.id = id;
	}

	/**
	* @return usedStreamHost
	*/
	public JID getUsedStreamHost() {
		return usedStreamHost;
	}

	/**
	* @param host
	*/
	public void setUsedStreamHost(JID host) {
		usedStreamHost = host;
	}

	/**
	* @return streamHosts, notnull.
	*/
	public Vector<StreamHost> getStreamHosts() {
		return streamHosts;
	}

	/**
	* @param streamHost, notnull.
	*/
	public void addStreamHost(StreamHost streamHost) {
		NotNull.exceptIfNull(streamHost, "streamHost");
		streamHosts.add(streamHost);
	}
}