ForwardingDataBroker 35/63135/2
authorMichael Vorburger <vorburger@redhat.com>
Thu, 14 Sep 2017 12:25:57 +0000 (14:25 +0200)
committerTom Pantelis <tompantelis@gmail.com>
Thu, 14 Sep 2017 21:17:50 +0000 (21:17 +0000)
as discussed on https://git.opendaylight.org/gerrit/#/c/63120/

Change-Id: I374d2a9f6cbad89f33e453eca270e5cc5f75a224
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/md/sal/binding/api/ForwardingDataBroker.java [new file with mode: 0644]

diff --git a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/md/sal/binding/api/ForwardingDataBroker.java b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/md/sal/binding/api/ForwardingDataBroker.java
new file mode 100644 (file)
index 0000000..92a4fb3
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2017 Red Hat, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * 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.binding.api;
+
+import com.google.common.collect.ForwardingObject;
+import javax.annotation.Nonnull;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+/**
+ * Utility {@link DataBroker} implementation which forwards all interface method
+ * invocation to a delegate instance.
+ */
+public abstract class ForwardingDataBroker extends ForwardingObject implements DataBroker {
+
+    @Override
+    protected abstract @Nonnull DataBroker delegate();
+
+    @Override
+    public ReadOnlyTransaction newReadOnlyTransaction() {
+        return delegate().newReadOnlyTransaction();
+    }
+
+    @Override
+    public ReadWriteTransaction newReadWriteTransaction() {
+        return delegate().newReadWriteTransaction();
+    }
+
+    @Override
+    public WriteTransaction newWriteOnlyTransaction() {
+        return delegate().newWriteOnlyTransaction();
+    }
+
+    @Override
+    public <T extends DataObject, L extends DataTreeChangeListener<T>> ListenerRegistration<L>
+            registerDataTreeChangeListener(DataTreeIdentifier<T> treeId, L listener) {
+        return delegate().registerDataTreeChangeListener(treeId, listener);
+    }
+
+    @Override
+    public ListenerRegistration<DataChangeListener> registerDataChangeListener(LogicalDatastoreType store,
+            InstanceIdentifier<?> path, DataChangeListener listener, DataChangeScope triggeringScope) {
+        return delegate().registerDataChangeListener(store, path, listener, triggeringScope);
+    }
+
+    @Override
+    public BindingTransactionChain createTransactionChain(TransactionChainListener listener) {
+        return delegate().createTransactionChain(listener);
+    }
+
+}

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.