Search in sources :

Example 1 with WhoAmIResponseImpl

use of org.apache.directory.api.ldap.extras.extended.whoAmI.WhoAmIResponseImpl in project directory-ldap-api by apache.

the class ApiLdapExtrasCodecApiOsgiTest method useBundleClasses.

@Override
protected void useBundleClasses() throws Exception {
    SynchronizationModeEnum.REFRESH_AND_PERSIST.getValue();
    new AdDirSyncImpl().getOid();
    new AdShowDeletedImpl().getOid();
    new AdPolicyHintsImpl().getOid();
    new ChangeNotificationsImpl().getOid();
    new PermissiveModifyImpl().getOid();
    new PasswordPolicyImpl().getOid();
    new PasswordPolicyResponseImpl().getGraceAuthNRemaining();
    new SyncDoneValueImpl().getOid();
    new SyncRequestValueImpl().getOid();
    new SyncStateValueImpl(true).getCookie();
    new VirtualListViewRequestImpl().getOid();
    new VirtualListViewResponseImpl().getOid();
    new PasswordModifyRequestImpl().getUserIdentity();
    new PasswordModifyResponseImpl(5).setResponseName("foo");
    new WhoAmIRequestImpl();
    new WhoAmIResponseImpl().setDn(new Dn("uid=admin,ou=system"));
    new StartTlsRequestImpl();
    new StartTlsResponseImpl();
    new StartTransactionRequestImpl();
    new StartTransactionResponseImpl();
}
Also used : PasswordPolicyImpl(org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyImpl) AdPolicyHintsImpl(org.apache.directory.api.ldap.extras.controls.ad.AdPolicyHintsImpl) SyncStateValueImpl(org.apache.directory.api.ldap.extras.controls.syncrepl.syncState.SyncStateValueImpl) WhoAmIRequestImpl(org.apache.directory.api.ldap.extras.extended.whoAmI.WhoAmIRequestImpl) AdDirSyncImpl(org.apache.directory.api.ldap.extras.controls.ad.AdDirSyncImpl) AdShowDeletedImpl(org.apache.directory.api.ldap.extras.controls.ad.AdShowDeletedImpl) WhoAmIResponseImpl(org.apache.directory.api.ldap.extras.extended.whoAmI.WhoAmIResponseImpl) SyncRequestValueImpl(org.apache.directory.api.ldap.extras.controls.syncrepl.syncRequest.SyncRequestValueImpl) Dn(org.apache.directory.api.ldap.model.name.Dn) VirtualListViewRequestImpl(org.apache.directory.api.ldap.extras.controls.vlv.VirtualListViewRequestImpl) PermissiveModifyImpl(org.apache.directory.api.ldap.extras.controls.permissiveModify.PermissiveModifyImpl) StartTlsResponseImpl(org.apache.directory.api.ldap.extras.extended.startTls.StartTlsResponseImpl) VirtualListViewResponseImpl(org.apache.directory.api.ldap.extras.controls.vlv.VirtualListViewResponseImpl) PasswordModifyRequestImpl(org.apache.directory.api.ldap.extras.extended.pwdModify.PasswordModifyRequestImpl) StartTlsRequestImpl(org.apache.directory.api.ldap.extras.extended.startTls.StartTlsRequestImpl) PasswordPolicyResponseImpl(org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyResponseImpl) SyncDoneValueImpl(org.apache.directory.api.ldap.extras.controls.syncrepl.syncDone.SyncDoneValueImpl) ChangeNotificationsImpl(org.apache.directory.api.ldap.extras.controls.changeNotifications.ChangeNotificationsImpl) StartTransactionRequestImpl(org.apache.directory.api.ldap.extras.extended.startTransaction.StartTransactionRequestImpl) PasswordModifyResponseImpl(org.apache.directory.api.ldap.extras.extended.pwdModify.PasswordModifyResponseImpl) StartTransactionResponseImpl(org.apache.directory.api.ldap.extras.extended.startTransaction.StartTransactionResponseImpl)

Example 2 with WhoAmIResponseImpl

use of org.apache.directory.api.ldap.extras.extended.whoAmI.WhoAmIResponseImpl in project directory-ldap-api by apache.

the class WhoAmIFactory method decorate.

/**
 * {@inheritDoc}
 */
@Override
public WhoAmIResponseDecorator decorate(ExtendedResponse decoratedResponse) {
    if (decoratedResponse instanceof WhoAmIResponseDecorator) {
        return (WhoAmIResponseDecorator) decoratedResponse;
    }
    if (decoratedResponse instanceof WhoAmIResponse) {
        return new WhoAmIResponseDecorator(codec, (WhoAmIResponse) decoratedResponse);
    }
    // It's an opaque extended operation
    @SuppressWarnings("unchecked") ExtendedResponseDecorator<ExtendedResponse> response = (ExtendedResponseDecorator<ExtendedResponse>) decoratedResponse;
    // Decode the response, as it's an opaque operation
    Asn1Decoder decoder = new Asn1Decoder();
    byte[] value = response.getResponseValue();
    ByteBuffer buffer = ByteBuffer.wrap(value);
    WhoAmIResponseContainer container = new WhoAmIResponseContainer();
    WhoAmIResponse whoAmIResponse = null;
    try {
        decoder.decode(buffer, container);
        whoAmIResponse = container.getWhoAmIResponse();
        // Now, update the created response with what we got from the extendedResponse
        whoAmIResponse.getLdapResult().setResultCode(response.getLdapResult().getResultCode());
        whoAmIResponse.getLdapResult().setDiagnosticMessage(response.getLdapResult().getDiagnosticMessage());
        whoAmIResponse.getLdapResult().setMatchedDn(response.getLdapResult().getMatchedDn());
        whoAmIResponse.getLdapResult().setReferral(response.getLdapResult().getReferral());
    } catch (DecoderException de) {
        StringWriter sw = new StringWriter();
        de.printStackTrace(new PrintWriter(sw));
        String stackTrace = sw.toString();
        // Error while decoding the value.
        whoAmIResponse = new WhoAmIResponseImpl(decoratedResponse.getMessageId(), ResultCodeEnum.OPERATIONS_ERROR, stackTrace);
    }
    return new WhoAmIResponseDecorator(codec, whoAmIResponse);
}
Also used : WhoAmIResponseImpl(org.apache.directory.api.ldap.extras.extended.whoAmI.WhoAmIResponseImpl) WhoAmIResponse(org.apache.directory.api.ldap.extras.extended.whoAmI.WhoAmIResponse) ByteBuffer(java.nio.ByteBuffer) DecoderException(org.apache.directory.api.asn1.DecoderException) StringWriter(java.io.StringWriter) ExtendedResponse(org.apache.directory.api.ldap.model.message.ExtendedResponse) ExtendedResponseDecorator(org.apache.directory.api.ldap.codec.decorators.ExtendedResponseDecorator) Asn1Decoder(org.apache.directory.api.asn1.ber.Asn1Decoder) PrintWriter(java.io.PrintWriter)

Example 3 with WhoAmIResponseImpl

use of org.apache.directory.api.ldap.extras.extended.whoAmI.WhoAmIResponseImpl in project directory-ldap-api by apache.

the class WhoAmIFactory method newResponse.

/**
 * {@inheritDoc}
 */
@Override
public WhoAmIResponse newResponse(byte[] encodedValue) throws DecoderException {
    WhoAmIResponseDecorator response = new WhoAmIResponseDecorator(codec, new WhoAmIResponseImpl());
    response.setResponseValue(encodedValue);
    return response;
}
Also used : WhoAmIResponseImpl(org.apache.directory.api.ldap.extras.extended.whoAmI.WhoAmIResponseImpl)

Aggregations

WhoAmIResponseImpl (org.apache.directory.api.ldap.extras.extended.whoAmI.WhoAmIResponseImpl)3 PrintWriter (java.io.PrintWriter)1 StringWriter (java.io.StringWriter)1 ByteBuffer (java.nio.ByteBuffer)1 DecoderException (org.apache.directory.api.asn1.DecoderException)1 Asn1Decoder (org.apache.directory.api.asn1.ber.Asn1Decoder)1 ExtendedResponseDecorator (org.apache.directory.api.ldap.codec.decorators.ExtendedResponseDecorator)1 AdDirSyncImpl (org.apache.directory.api.ldap.extras.controls.ad.AdDirSyncImpl)1 AdPolicyHintsImpl (org.apache.directory.api.ldap.extras.controls.ad.AdPolicyHintsImpl)1 AdShowDeletedImpl (org.apache.directory.api.ldap.extras.controls.ad.AdShowDeletedImpl)1 ChangeNotificationsImpl (org.apache.directory.api.ldap.extras.controls.changeNotifications.ChangeNotificationsImpl)1 PermissiveModifyImpl (org.apache.directory.api.ldap.extras.controls.permissiveModify.PermissiveModifyImpl)1 PasswordPolicyImpl (org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyImpl)1 PasswordPolicyResponseImpl (org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyResponseImpl)1 SyncDoneValueImpl (org.apache.directory.api.ldap.extras.controls.syncrepl.syncDone.SyncDoneValueImpl)1 SyncRequestValueImpl (org.apache.directory.api.ldap.extras.controls.syncrepl.syncRequest.SyncRequestValueImpl)1 SyncStateValueImpl (org.apache.directory.api.ldap.extras.controls.syncrepl.syncState.SyncStateValueImpl)1 VirtualListViewRequestImpl (org.apache.directory.api.ldap.extras.controls.vlv.VirtualListViewRequestImpl)1 VirtualListViewResponseImpl (org.apache.directory.api.ldap.extras.controls.vlv.VirtualListViewResponseImpl)1 PasswordModifyRequestImpl (org.apache.directory.api.ldap.extras.extended.pwdModify.PasswordModifyRequestImpl)1