use of org.apache.directory.api.ldap.codec.BasicControlDecorator in project directory-ldap-api by apache.
the class DefaultLdapCodecService method fromJndiControl.
/**
* {@inheritDoc}
*/
@Override
public Control fromJndiControl(javax.naming.ldap.Control control) throws DecoderException {
@SuppressWarnings("rawtypes") ControlFactory factory = controlFactories.get(control.getID());
if (factory == null) {
OpaqueControl ourControl = new OpaqueControl(control.getID());
ourControl.setCritical(control.isCritical());
BasicControlDecorator decorator = new BasicControlDecorator(this, ourControl);
decorator.setValue(control.getEncodedValue());
return decorator;
}
@SuppressWarnings("unchecked") CodecControl<? extends Control> ourControl = factory.newCodecControl();
ourControl.setCritical(control.isCritical());
ourControl.setValue(control.getEncodedValue());
ourControl.decode(control.getEncodedValue());
return ourControl;
}
Aggregations