Search in sources :

Example 1 with StartTlsResponse

use of org.apache.directory.api.ldap.extras.extended.startTls.StartTlsResponse in project directory-ldap-api by apache.

the class StartTlsFactory method decorate.

/**
 * {@inheritDoc}
 */
@Override
public StartTlsResponseDecorator decorate(ExtendedResponse decoratedResponse) {
    if (decoratedResponse instanceof StartTlsResponseDecorator) {
        return (StartTlsResponseDecorator) decoratedResponse;
    }
    if (decoratedResponse instanceof StartTlsResponse) {
        return new StartTlsResponseDecorator(codec, (StartTlsResponse) decoratedResponse);
    }
    // It's an opaque extended operation
    @SuppressWarnings("unchecked") ExtendedResponseDecorator<ExtendedResponse> response = (ExtendedResponseDecorator<ExtendedResponse>) decoratedResponse;
    // Decode the response, as it's an opaque operation
    StartTlsResponse startTlsResponse = new StartTlsResponseImpl(response.getMessageId());
    startTlsResponse.getLdapResult().setResultCode(response.getLdapResult().getResultCode());
    startTlsResponse.getLdapResult().setDiagnosticMessage(response.getLdapResult().getDiagnosticMessage());
    return new StartTlsResponseDecorator(codec, new StartTlsResponseImpl());
}
Also used : StartTlsResponseImpl(org.apache.directory.api.ldap.extras.extended.startTls.StartTlsResponseImpl) StartTlsResponse(org.apache.directory.api.ldap.extras.extended.startTls.StartTlsResponse) ExtendedResponse(org.apache.directory.api.ldap.model.message.ExtendedResponse) ExtendedResponseDecorator(org.apache.directory.api.ldap.codec.decorators.ExtendedResponseDecorator)

Aggregations

ExtendedResponseDecorator (org.apache.directory.api.ldap.codec.decorators.ExtendedResponseDecorator)1 StartTlsResponse (org.apache.directory.api.ldap.extras.extended.startTls.StartTlsResponse)1 StartTlsResponseImpl (org.apache.directory.api.ldap.extras.extended.startTls.StartTlsResponseImpl)1 ExtendedResponse (org.apache.directory.api.ldap.model.message.ExtendedResponse)1