a23fc70450d4909db4f9e1f61c2d11b60838ce25
[controller.git] / opendaylight / md-sal / mdsal-trace / dom-impl / src / main / java / org / opendaylight / controller / md / sal / trace / dom / impl / TracingReadOnlyTransaction.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.trace.dom.impl;
9
10 import com.google.common.base.Optional;
11 import com.google.common.util.concurrent.CheckedFuture;
12 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
13 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
14 import org.opendaylight.controller.md.sal.dom.api.DOMDataReadOnlyTransaction;
15 import org.opendaylight.controller.md.sal.trace.closetracker.impl.AbstractCloseTracked;
16 import org.opendaylight.controller.md.sal.trace.closetracker.impl.CloseTrackedRegistry;
17 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
18 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
19
20 @Deprecated
21 class TracingReadOnlyTransaction
22         extends AbstractCloseTracked<TracingReadOnlyTransaction>
23         implements DOMDataReadOnlyTransaction {
24
25     private final DOMDataReadOnlyTransaction delegate;
26
27     TracingReadOnlyTransaction(DOMDataReadOnlyTransaction delegate,
28             CloseTrackedRegistry<TracingReadOnlyTransaction> readOnlyTransactionsRegistry) {
29         super(readOnlyTransactionsRegistry);
30         this.delegate = delegate;
31     }
32
33     @Override
34     public CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> read(LogicalDatastoreType store,
35             YangInstanceIdentifier path) {
36         return delegate.read(store, path);
37     }
38
39     @Override
40     public CheckedFuture<Boolean, ReadFailedException> exists(LogicalDatastoreType store, YangInstanceIdentifier path) {
41         return delegate.exists(store, path);
42     }
43
44     @Override
45     public Object getIdentifier() {
46         return delegate.getIdentifier();
47     }
48
49     @Override
50     public void close() {
51         delegate.close();
52         super.removeFromTrackedRegistry();
53     }
54
55
56     // https://jira.opendaylight.org/browse/CONTROLLER-1792
57
58     @Override
59     public final boolean equals(Object object) {
60         return object == this || delegate.equals(object);
61     }
62
63     @Override
64     public final int hashCode() {
65         return delegate.hashCode();
66     }
67
68     @Override
69     public final String toString() {
70         return getClass().getName() + "; delegate=" + delegate;
71     }
72
73 }

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