blob: 8242383bcc00f67ca6cf350811ecacb3a4950a04 [file] [log] [blame]
Sithara Punnassery589fac22016-10-03 11:51:53 -07001/*
2 * Copyright 2016-present Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.incubator.elasticcfg;
17
18import org.onlab.util.Identifier;
19
20import static com.google.common.base.Preconditions.checkNotNull;
21
22/**
23 * Abstraction of the key to an instance in the elastic config store.
24 * Path to each node would contain info about its hierarchy too.
25 */
26public final class ConfigNodePath extends Identifier<String> {
27
28 private final String parentKey;
29 private final String nodeKey;
30
31 /**
32 * Creates a new ConfigNodePath from parentKey and nodeKey.
33 *
34 * @param parentKey absolute path to the parent.
35 * @param nodeKey relative path to the node.
36 */
37 public ConfigNodePath(String parentKey, String nodeKey) {
38 super(checkNotNull(parentKey, "parent key is null").concat(checkNotNull(nodeKey, "node key is null")));
39 this.parentKey = parentKey;
40 this.nodeKey = nodeKey;
41 }
42
43 /**
44 * Returns the parent key.
45 *
46 * @return absolute path to the parent
47 */
48 public String parentKey() {
49 return parentKey;
50 }
51
52 /**
53 * Returns the node key.
54 *
55 * @return relative path to the node
56 */
57 public String nodeKey() {
58 return nodeKey;
59 }
60}