1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.directory.api.dsmlv2.request;
21
22
23 import org.apache.directory.api.ldap.codec.api.LdapApiService;
24 import org.apache.directory.api.ldap.model.message.BindRequest;
25 import org.apache.directory.api.ldap.model.message.BindRequestImpl;
26 import org.apache.directory.api.ldap.model.message.BindResponse;
27 import org.apache.directory.api.ldap.model.message.Control;
28 import org.apache.directory.api.ldap.model.message.MessageTypeEnum;
29 import org.apache.directory.api.ldap.model.name.Dn;
30 import org.dom4j.Element;
31
32
33
34
35
36
37
38 public class BindRequestDsml
39 extends AbstractResultResponseRequestDsml<BindRequest, BindResponse>
40 implements BindRequest
41 {
42
43
44
45
46
47 public BindRequestDsml( LdapApiService codec )
48 {
49 super( codec, new BindRequestImpl() );
50 }
51
52
53
54
55
56
57
58
59 public BindRequestDsml( LdapApiService codec, BindRequest ldapMessage )
60 {
61 super( codec, ldapMessage );
62 }
63
64
65
66
67
68 public MessageTypeEnum getType()
69 {
70 return getDecorated().getType();
71 }
72
73
74
75
76
77 public Element toDsml( Element root )
78 {
79 Element element = super.toDsml( root );
80
81 BindRequest request = getDecorated();
82
83
84 Dn dn = request.getDn();
85
86 if ( !Dn.isNullOrEmpty( dn ) )
87 {
88
89
90 element.addAttribute( "principal", dn.getName() );
91 }
92 else
93 {
94
95
96 String name = request.getName();
97
98 element.addAttribute( "principal", name );
99 }
100
101 return element;
102 }
103
104
105
106
107
108 public MessageTypeEnum getResponseType()
109 {
110 return getDecorated().getResponseType();
111 }
112
113
114
115
116
117 public boolean isSimple()
118 {
119 return getDecorated().isSimple();
120 }
121
122
123
124
125
126 public boolean getSimple()
127 {
128 return getDecorated().getSimple();
129 }
130
131
132
133
134
135 public BindRequest setSimple( boolean isSimple )
136 {
137 getDecorated().setSimple( isSimple );
138
139 return this;
140 }
141
142
143
144
145
146 public byte[] getCredentials()
147 {
148 return getDecorated().getCredentials();
149 }
150
151
152
153
154
155 public BindRequest setCredentials( String credentials )
156 {
157 getDecorated().setCredentials( credentials );
158
159 return this;
160 }
161
162
163
164
165
166 public BindRequest setCredentials( byte[] credentials )
167 {
168 getDecorated().setCredentials( credentials );
169
170 return this;
171 }
172
173
174
175
176
177 public String getName()
178 {
179 return getDecorated().getName();
180 }
181
182
183
184
185
186 public BindRequest setName( String name )
187 {
188 getDecorated().setName( name );
189
190 return this;
191 }
192
193
194
195
196
197 public Dn getDn()
198 {
199 return getDecorated().getDn();
200 }
201
202
203
204
205
206 public BindRequest setDn( Dn dn )
207 {
208 getDecorated().setDn( dn );
209
210 return this;
211 }
212
213
214
215
216
217 public boolean isVersion3()
218 {
219 return getDecorated().isVersion3();
220 }
221
222
223
224
225
226 public boolean getVersion3()
227 {
228 return getDecorated().getVersion3();
229 }
230
231
232
233
234
235 public BindRequest setVersion3( boolean isVersion3 )
236 {
237 getDecorated().setVersion3( isVersion3 );
238
239 return this;
240 }
241
242
243
244
245
246 public String getSaslMechanism()
247 {
248 return getDecorated().getSaslMechanism();
249 }
250
251
252
253
254
255 public BindRequest setSaslMechanism( String saslMechanism )
256 {
257 getDecorated().setSaslMechanism( saslMechanism );
258
259 return this;
260 }
261
262
263
264
265
266 public BindRequest setMessageId( int messageId )
267 {
268 super.setMessageId( messageId );
269
270 return this;
271 }
272
273
274
275
276
277 public BindRequest addControl( Control control )
278 {
279 return ( BindRequest ) super.addControl( control );
280 }
281
282
283
284
285
286 public BindRequest addAllControls( Control[] controls )
287 {
288 return ( BindRequest ) super.addAllControls( controls );
289 }
290
291
292
293
294
295 public BindRequest removeControl( Control control )
296 {
297 return ( BindRequest ) super.removeControl( control );
298 }
299 }