blob: db38dd2802b6973649944355429e2d99f04f91bc (
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
|
/*
* Copyright (c) 2010-2012, Isode Limited, London, England.
* All rights reserved.
*/
/*
* Copyright (c) 2010, Remko Tron?on.
* All rights reserved.
*/
package com.isode.stroke.elements;
//FIXME: parser/serialiser
import java.util.ArrayList;
import java.util.Collection;
public class StreamFeatures implements Element {
public StreamFeatures() {
hasStartTLS_ = false;
hasResourceBind_ = false;
hasSession_ = false;
hasStreamManagement_ = false;
}
public void setHasStartTLS() {
hasStartTLS_ = true;
}
public boolean hasStartTLS() {
return hasStartTLS_;
}
public void setHasSession() {
hasSession_ = true;
}
public boolean hasSession() {
return hasSession_;
}
public void setHasResourceBind() {
hasResourceBind_ = true;
}
public boolean hasResourceBind() {
return hasResourceBind_;
}
public Collection<String> getCompressionMethods() {
return compressionMethods_;
}
public void addCompressionMethod(String mechanism) {
compressionMethods_.add(mechanism);
}
public boolean hasCompressionMethod(String mechanism) {
return compressionMethods_.contains(mechanism);
}
public Collection<String> getAuthenticationMechanisms() {
return authenticationMechanisms_;
}
public void addAuthenticationMechanism(String mechanism) {
authenticationMechanisms_.add(mechanism);
}
public boolean hasAuthenticationMechanism(String mechanism) {
return authenticationMechanisms_.contains(mechanism);
}
public boolean hasAuthenticationMechanisms() {
return !authenticationMechanisms_.isEmpty();
}
public String getAuthenticationHostname() {
return authenticationHostname_;
}
public void setAuthenticationHostname(String authenticationHostname) {
authenticationHostname_ = authenticationHostname;
}
public boolean hasStreamManagement() {
return hasStreamManagement_;
}
public void setHasStreamManagement() {
hasStreamManagement_ = true;
}
public boolean hasRosterVersioning() {
return hasRosterVersioning_;
}
public void setHasRosterVersioning() {
hasRosterVersioning_ = true;
}
@Override
public String toString() {
return "StreamFeatures: hasStartTLS=" + hasStartTLS_ +
"; hasResourceBind_=" + hasResourceBind_ +
"; hasSession_=" + hasSession_ +
"; hasStreamManagement_ =" + hasStreamManagement_ +
"; compression methods:" + compressionMethods_.size() +
"; authentication mechs:" + authenticationMechanisms_.size();
}
private boolean hasStartTLS_;
private ArrayList<String> compressionMethods_ = new ArrayList<String>();
private ArrayList<String> authenticationMechanisms_ = new ArrayList<String>();
private boolean hasResourceBind_;
private boolean hasSession_;
private boolean hasStreamManagement_;
private boolean hasRosterVersioning_;
private String authenticationHostname_;
}
|