* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.controller.md.sal.dom.broker.impl.legacy.sharded.adapter;
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.base.Optional;
import com.google.common.util.concurrent.CheckedFuture;
import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.MoreExecutors;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
import org.opendaylight.controller.md.sal.dom.api.DOMDataReadOnlyTransaction;
* return all relevant data, we cannot guarantee it neither. Best effort is to
* return all data we get from first initial data change event received.
*/
+@Deprecated
class ShardedDOMDataBrokerDelegatingReadTransaction implements DOMDataReadOnlyTransaction {
private final DOMDataTreeReadTransaction delegateTx;
private final Object txIdentifier;
@Override
public CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> read(final LogicalDatastoreType store,
final YangInstanceIdentifier path) {
- return Futures.makeChecked(
- delegateTx.read(LegacyShardedDOMDataBrokerAdapterUtils.translateDataStoreType(store), path),
- ReadFailedException.MAPPER);
+ return Futures.makeChecked(delegateTx.read(store.toMdsal(), path).transform(
+ Optional::fromJavaUtil, MoreExecutors.directExecutor()), ReadFailedException.MAPPER);
}
@Override
public CheckedFuture<Boolean, ReadFailedException> exists(final LogicalDatastoreType store,
final YangInstanceIdentifier path) {
- return Futures.makeChecked(
- delegateTx.exists(LegacyShardedDOMDataBrokerAdapterUtils.translateDataStoreType(store), path),
- ReadFailedException.MAPPER);
+ return Futures.makeChecked(delegateTx.exists(store.toMdsal(), path), ReadFailedException.MAPPER);
}
@Override