2 * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.mdsal.binding.dom.adapter;
10 import com.google.common.util.concurrent.FluentFuture;
11 import javax.annotation.Nullable;
12 import org.eclipse.jdt.annotation.NonNull;
13 import org.opendaylight.mdsal.binding.api.CursorAwareWriteTransaction;
14 import org.opendaylight.mdsal.binding.api.DataTreeIdentifier;
15 import org.opendaylight.mdsal.binding.api.DataTreeWriteCursor;
16 import org.opendaylight.mdsal.common.api.CommitInfo;
17 import org.opendaylight.mdsal.dom.api.DOMDataTreeCursorAwareTransaction;
18 import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
19 import org.opendaylight.mdsal.dom.api.DOMDataTreeWriteCursor;
20 import org.opendaylight.yangtools.yang.binding.DataObject;
21 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
23 public class BindingDOMCursorAwareWriteTransactionAdapter<T extends DOMDataTreeCursorAwareTransaction>
24 extends AbstractBindingAdapter<T> implements CursorAwareWriteTransaction {
26 public BindingDOMCursorAwareWriteTransactionAdapter(final T delegate, final BindingToNormalizedNodeCodec codec) {
27 super(codec, delegate);
32 public <P extends DataObject> DataTreeWriteCursor createCursor(final DataTreeIdentifier<P> path) {
33 final YangInstanceIdentifier yPath = getCodec().toNormalized(path.getRootIdentifier());
34 final DOMDataTreeWriteCursor cursor = getDelegate().createCursor(
35 new DOMDataTreeIdentifier(path.getDatastoreType(), yPath));
36 return new BindingDOMDataTreeWriteCursorAdapter<>(path, cursor, getCodec());
40 public boolean cancel() {
41 return getDelegate().cancel();
45 public FluentFuture<? extends @NonNull CommitInfo> commit() {
46 return getDelegate().commit();