7b8add90379010bdeeb03a860524e8f89d92e497
[controller.git] / opendaylight / md-sal / sal-inmemory-datastore / src / main / java / org / opendaylight / controller / md / sal / dom / store / impl / tree / ListenerWalker.java
1 /**
2  * Copyright (c) 2014 Cisco Systems, 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.dom.store.impl.tree;
9
10 import com.google.common.base.Preconditions;
11 import org.opendaylight.controller.md.sal.dom.store.impl.DataChangeListenerRegistration;
12 import org.opendaylight.mdsal.dom.spi.RegistrationTreeSnapshot;
13
14 /**
15  * A walking context, pretty much equivalent to an iterator, but it
16  * exposes the underlying tree structure.
17  *
18  * @author Robert Varga
19  *
20  * @deprecated Superseded by {@link RegistrationTreeSnapshot}.
21  */
22 @Deprecated
23 public class ListenerWalker implements AutoCloseable {
24     private final RegistrationTreeSnapshot<DataChangeListenerRegistration<?>> delegate;
25
26     ListenerWalker(final RegistrationTreeSnapshot<DataChangeListenerRegistration<?>> delegate) {
27         this.delegate = Preconditions.checkNotNull(delegate);
28     }
29
30     public ListenerNode getRootNode() {
31         return new ListenerNode(delegate.getRootNode());
32     }
33
34     @Override
35     public void close() {
36         delegate.close();
37     }
38 }