c7cc56860219912749e70af375117c0478cc9a35
[controller.git] / opendaylight / md-sal / sal-binding-api / src / main / java / org / opendaylight / controller / md / sal / binding / api / ForwardingReadOnlyTransaction.java
1 /*
2  * Copyright (c) 2017 Red Hat, Inc. and others. All rights reserved.
3  *
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
7  */
8 package org.opendaylight.controller.md.sal.binding.api;
9
10 import com.google.common.base.Optional;
11 import com.google.common.collect.ForwardingObject;
12 import com.google.common.util.concurrent.CheckedFuture;
13 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
14 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
15 import org.opendaylight.yangtools.yang.binding.DataObject;
16 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
17
18 /**
19  * Utility {@link ReadOnlyTransaction} implementation which forwards all interface method
20  * invocation to a delegate instance.
21  *
22  * @deprecated Use org.opendaylight.mdsal.binding.spi.ForwardingReadTransaction instead.
23  */
24 @Deprecated
25 public class ForwardingReadOnlyTransaction extends ForwardingObject implements ReadOnlyTransaction {
26
27     private final ReadOnlyTransaction delegate;
28
29     protected ForwardingReadOnlyTransaction(final ReadOnlyTransaction delegate) {
30         this.delegate = delegate;
31     }
32
33     @Override
34     protected ReadTransaction delegate() {
35         return delegate;
36     }
37
38     @Override
39     public <T extends DataObject> CheckedFuture<Optional<T>, ReadFailedException> read(final LogicalDatastoreType store,
40             final InstanceIdentifier<T> path) {
41         return delegate.read(store, path);
42     }
43
44     @Override
45     public CheckedFuture<Boolean, ReadFailedException> exists(final LogicalDatastoreType store,
46             final InstanceIdentifier<?> path) {
47         return delegate.exists(store, path);
48     }
49
50     @Override
51     public Object getIdentifier() {
52         return delegate.getIdentifier();
53     }
54
55     @Override
56     public void close() {
57         delegate.close();
58     }
59 }

©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.