BUG-1568 Remove ganymed Ssh client adapter
[controller.git] / opendaylight / md-sal / sal-clustering-commons / src / main / java / org / opendaylight / controller / cluster / datastore / node / utils / NormalizedNodeGetter.java
1 /*
2  *
3  *  Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
4  *
5  *  This program and the accompanying materials are made available under the
6  *  terms of the Eclipse Public License v1.0 which accompanies this distribution,
7  *  and is available at http://www.eclipse.org/legal/epl-v10.html
8  *
9  */
10
11 package org.opendaylight.controller.cluster.datastore.node.utils;
12
13 import com.google.common.base.Preconditions;
14 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
15
16 public class NormalizedNodeGetter implements
17     NormalizedNodeVisitor {
18     private final String path;
19     NormalizedNode output;
20
21     public NormalizedNodeGetter(String path){
22         Preconditions.checkNotNull(path);
23         this.path = path;
24     }
25
26     @Override
27     public void visitNode(int level, String parentPath, NormalizedNode normalizedNode) {
28         String nodePath = parentPath + "/"+ normalizedNode.getIdentifier().toString();
29
30         if(nodePath.toString().equals(path)){
31             output = normalizedNode;
32         }
33     }
34
35     public NormalizedNode getOutput(){
36         return output;
37     }
38 }