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;
21
22
23 import org.apache.directory.api.ldap.codec.api.LdapApiService;
24 import org.apache.directory.api.ldap.model.message.Control;
25 import org.dom4j.Element;
26
27
28
29
30
31
32
33
34
35 public class DsmlControl<C extends Control> implements Control, DsmlDecorator<C>
36 {
37
38 private C decorated;
39
40
41 protected byte[] value;
42
43
44 private LdapApiService codec;
45
46
47
48
49
50
51
52 public DsmlControl( LdapApiService codec, C decorated )
53 {
54 this.codec = codec;
55 this.decorated = decorated;
56 }
57
58
59
60
61
62 public LdapApiService getCodecService()
63 {
64 return codec;
65 }
66
67
68
69
70
71
72
73 public boolean hasValue()
74 {
75 return value != null;
76 }
77
78
79
80
81
82
83
84 public byte[] getValue()
85 {
86 return value;
87 }
88
89
90
91
92
93
94
95 public void setValue( byte[] value )
96 {
97 if ( value != null )
98 {
99 byte[] copy = new byte[value.length];
100 System.arraycopy( value, 0, copy, 0, value.length );
101 this.value = copy;
102 }
103 else
104 {
105 this.value = null;
106 }
107 }
108
109
110
111
112
113 @Override
114 public String getOid()
115 {
116 return decorated.getOid();
117 }
118
119
120
121
122
123 @Override
124 public boolean isCritical()
125 {
126 return decorated.isCritical();
127 }
128
129
130
131
132
133 @Override
134 public void setCritical( boolean isCritical )
135 {
136 decorated.setCritical( isCritical );
137 }
138
139
140
141
142
143 @Override
144 public Element toDsml( Element root )
145 {
146 return null;
147 }
148
149
150
151
152
153 @Override
154 public C getDecorated()
155 {
156 return decorated;
157 }
158 }