1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 *
19 */
20 package org.apache.directory.api.ldap.model.message;
21
22
23 import org.apache.directory.api.i18n.I18n;
24
25
26 /**
27 * Lockable UnbindRequest implementation.
28 *
29 * @author <a href="mailto:dev@directory.apache.org"> Apache Directory Project</a>
30 */
31 public class UnbindRequestImpl extends AbstractRequest implements UnbindRequest
32 {
33 static final long serialVersionUID = -6217184085100410116L;
34
35
36 /**
37 * Creates an UnbindRequest which takes no parameter other than those in the
38 * outer envelope to disconnect and end a client session on the server
39 * without producing any response.
40 *
41 * @param id the sequential message identifier.
42 */
43 public UnbindRequestImpl()
44 {
45 super( -1, MessageTypeEnum.UNBIND_REQUEST, false );
46 }
47
48
49 /**
50 * RFC 2251 [Section 4.11]: Abandon, Bind, Unbind, and StartTLS operations
51 * cannot be abandoned.
52 */
53 public void abandon()
54 {
55 throw new UnsupportedOperationException( I18n.err( I18n.ERR_04185 ) );
56 }
57
58
59 /**
60 * {@inheritDoc}
61 */
62 public UnbindRequest setMessageId( int messageId )
63 {
64 super.setMessageId( messageId );
65
66 return this;
67 }
68
69
70 /**
71 * {@inheritDoc}
72 */
73 public UnbindRequest addControl( Control control )
74 {
75 return ( UnbindRequest ) super.addControl( control );
76 }
77
78
79 /**
80 * {@inheritDoc}
81 */
82 public UnbindRequest addAllControls( Control[] controls )
83 {
84 return ( UnbindRequest ) super.addAllControls( controls );
85 }
86
87
88 /**
89 * {@inheritDoc}
90 */
91 public UnbindRequest removeControl( Control control )
92 {
93 return ( UnbindRequest ) super.removeControl( control );
94 }
95
96
97 /**
98 * Get a String representation of a UnBindRequest
99 *
100 * @return A UnBindRequest String
101 */
102 public String toString()
103 {
104 StringBuilder sb = new StringBuilder();
105
106 sb.append( " UnBind Request" );
107
108 // The controls
109 sb.append( super.toString() );
110
111 return super.toString( sb.toString() );
112 }
113 }