| | |
| | | * Header, with the fields enclosed by brackets [] replaced by your own identifying |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2013-2015 ForgeRock AS. |
| | | * Copyright 2013-2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.rest2ldap; |
| | | |
| | |
| | | private static final class CachedRead implements SearchResultHandler, LdapResultHandler<Result> { |
| | | private SearchResultEntry cachedEntry; |
| | | private final String cachedFilterString; |
| | | /** Guarded by cachedPromiseLatch.*/ |
| | | /** Guarded by cachedPromiseLatch. */ |
| | | private LdapPromise<Result> cachedPromise; |
| | | private final CountDownLatch cachedPromiseLatch = new CountDownLatch(1); |
| | | private final SearchRequest cachedRequest; |
| | |
| | | searchResultHandler.handleEntry(cachedEntry); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | this.config = config; |
| | | this.context = context; |
| | | |
| | | /* |
| | | * Re-use the pre-authenticated connection if available and the |
| | | * authorization policy allows. |
| | | */ |
| | | /* Re-use the pre-authenticated connection if available and the authorization policy allows. */ |
| | | if (config.getAuthorizationPolicy() != AuthorizationPolicy.NONE |
| | | && context.containsContext(AuthenticatedConnectionContext.class)) { |
| | | this.connection = wrap(context.asContext(AuthenticatedConnectionContext.class).getConnection()); |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void close() { |
| | | connection.close(); |
| | |
| | | * if needed. |
| | | */ |
| | | private Connection wrap(final Connection connection) { |
| | | /* |
| | | * We only use async methods so no need to wrap sync methods. |
| | | */ |
| | | /* We only use async methods so no need to wrap sync methods. */ |
| | | return new AbstractAsynchronousConnection() { |
| | | @Override |
| | | public LdapPromise<Void> abandonAsync(final AbandonRequest request) { |
| | |
| | | } |
| | | }; |
| | | } |
| | | |
| | | } |