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