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 org.eclipse.jdt.annotation.NonNull;
12 import org.opendaylight.mdsal.binding.api.CursorAwareWriteTransaction;
13 import org.opendaylight.mdsal.binding.api.DataTreeIdentifier;
14 import org.opendaylight.mdsal.binding.api.DataTreeWriteCursor;
15 import org.opendaylight.mdsal.common.api.CommitInfo;
16 import org.opendaylight.mdsal.dom.api.DOMDataTreeCursorAwareTransaction;
17 import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
18 import org.opendaylight.mdsal.dom.api.DOMDataTreeWriteCursor;
19 import org.opendaylight.yangtools.yang.binding.DataObject;
20 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
22 final class BindingDOMCursorAwareWriteTransactionAdapter<T extends DOMDataTreeCursorAwareTransaction>
23 extends AbstractBindingAdapter<T> implements CursorAwareWriteTransaction {
24 BindingDOMCursorAwareWriteTransactionAdapter(final AdapterContext adapterContext, final T delegate) {
25 super(adapterContext, delegate);
29 public <P extends DataObject> DataTreeWriteCursor createCursor(final DataTreeIdentifier<P> path) {
30 final YangInstanceIdentifier yPath = currentSerializer().toYangInstanceIdentifier(path.getRootIdentifier());
31 final DOMDataTreeWriteCursor cursor = getDelegate().createCursor(
32 new DOMDataTreeIdentifier(path.getDatastoreType(), yPath));
33 return new BindingDOMDataTreeWriteCursorAdapter<>(adapterContext(), cursor, path);
37 public boolean cancel() {
38 return getDelegate().cancel();
42 public FluentFuture<? extends @NonNull CommitInfo> commit() {
43 return getDelegate().commit();