Shankara-Huawei
Committed by Gerrit Code Review

XPATH Datamodel For YangUtils

Change-Id: I39449323a6d43ad293ac7ae986dc983d35eb944b
1 +/*
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 + */
16 +package org.onosproject.yangutils.datamodel;
17 +
18 +import java.io.Serializable;
19 +import java.util.List;
20 +
21 +/**
22 + * Representation of data model node to maintain absolute path defined in YANG path-arg.
23 + */
24 +public class YangAtomicPath implements Serializable {
25 +
26 + private static final long serialVersionUID = 806201688L;
27 +
28 + // YANG node identifier.
29 + private YangNodeIdentifier nodeIdentifier;
30 +
31 + // List of path predicates expression.
32 + private List<YangPathPredicate> pathPredicatesList;
33 +
34 + /**
35 + * Returns the node identifier.
36 + *
37 + * @return the node identifier
38 + */
39 + public YangNodeIdentifier getNodeIdentifier() {
40 + return nodeIdentifier;
41 + }
42 +
43 + /**
44 + * Sets the node identifier.
45 + *
46 + * @param nodeIdentifier Sets the node identifier
47 + */
48 + public void setNodeIdentifier(YangNodeIdentifier nodeIdentifier) {
49 + this.nodeIdentifier = nodeIdentifier;
50 + }
51 +
52 + /**
53 + * Returns the path predicate expression.
54 + *
55 + * @return the path predicate expression
56 + */
57 + public List<YangPathPredicate> getPathPredicatesList() {
58 + return pathPredicatesList;
59 + }
60 +
61 + /**
62 + * Sets the path predicate expression.
63 + *
64 + * @param pathPredicatesList Sets the path predicate expression
65 + */
66 + public void setPathPredicatesList(List<YangPathPredicate> pathPredicatesList) {
67 + this.pathPredicatesList = pathPredicatesList;
68 + }
69 +
70 + /**
71 + * Adds predicate expression in data holder.
72 + *
73 + * @param predicatesExp the predicate expression to be added
74 + */
75 + public void addLeavesPredicate(YangPathPredicate predicatesExp) {
76 + getPathPredicatesList().add(predicatesExp);
77 + }
78 +}
1 +/*
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 + */
16 +package org.onosproject.yangutils.datamodel;
17 +
18 +/**
19 + * Represents path argument type in data model tree.
20 + */
21 +public enum YangPathArgType {
22 +
23 + // Absolute path.
24 + ABSOLUTE_PATH,
25 +
26 + // Relative path.
27 + RELATIVE_PATH
28 +
29 +}
1 +/*
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 + */
16 +package org.onosproject.yangutils.datamodel;
17 +
18 +/**
19 + * Represents path-expr in data model tree.
20 + */
21 +public enum YangPathOperator {
22 +
23 + // Path expression contains equal to.
24 + EQUALTO
25 +}
1 +/*
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 + */
16 +package org.onosproject.yangutils.datamodel;
17 +
18 +import java.io.Serializable;
19 +
20 +/**
21 + * Representation of data model node to maintain path predicate in YANG absolute-path or relative-path.
22 + */
23 +public class YangPathPredicate<T> implements Serializable {
24 +
25 + private static final long serialVersionUID = 806201689L;
26 +
27 + // YANG node identifier.
28 + private YangNodeIdentifier nodeIdentifier;
29 +
30 + // Left axis node will represent the nodeidentifier before equality sign in path predicate.
31 + private T leftAxisNode;
32 +
33 + // YANG path operator.
34 + private YangPathOperator pathOperator;
35 +
36 + // YANG relative path.
37 + private YangRelativePath rightRelativePath;
38 +
39 + // Right axis node will represent the nodeidentifier after equality sign in path predicate.
40 + private T rightAxisNode;
41 +
42 + /**
43 + * Returns the path expression operator.
44 + *
45 + * @return the path expression operator
46 + */
47 + public YangPathOperator getPathOperator() {
48 + return pathOperator;
49 + }
50 +
51 + /**
52 + * Sets the path expression operator.
53 + *
54 + * @param pathOperator Sets the path expression operator
55 + */
56 + public void setPathOperator(YangPathOperator pathOperator) {
57 + this.pathOperator = pathOperator;
58 + }
59 +
60 + /**
61 + * Returns the right relative path expression.
62 + *
63 + * @return the right relative path expression
64 + */
65 + public YangRelativePath getRightRelativePath() {
66 + return rightRelativePath;
67 + }
68 +
69 + /**
70 + * Sets the right relative path expression.
71 + *
72 + * @param rightRelativePath Sets the right relative path expression
73 + */
74 + public void setRightRelativePath(YangRelativePath rightRelativePath) {
75 + this.rightRelativePath = rightRelativePath;
76 + }
77 +
78 + /**
79 + * Returns the nodeidentifier.
80 + *
81 + * @return the nodeidentifier
82 + */
83 + public YangNodeIdentifier getNodeIdentifier() {
84 + return nodeIdentifier;
85 + }
86 +
87 + /**
88 + * Sets the YANG node identifier.
89 + *
90 + * @param nodeIdentifier Sets the node identifier
91 + *
92 + */
93 + public void setNodeIdentifier(YangNodeIdentifier nodeIdentifier) {
94 + this.nodeIdentifier = nodeIdentifier;
95 + }
96 +
97 + /**
98 + * Returns the left axis node.
99 + *
100 + * @return the left axis node
101 + */
102 + public T getLeftAxisNode() {
103 + return leftAxisNode;
104 + }
105 +
106 + /**
107 + * Sets the left axis node.
108 + *
109 + * @param leftAxisNode Sets the left axis node
110 + */
111 + public void setLeftAxisNode(T leftAxisNode) {
112 + this.leftAxisNode = leftAxisNode;
113 + }
114 +
115 + /**
116 + * Returns the right axis node.
117 + *
118 + * @return the right axis node
119 + */
120 + public T getRightAxisNode() {
121 + return rightAxisNode;
122 + }
123 +
124 + /**
125 + * Sets the right axis node.
126 + *
127 + * @param rightAxisNode Sets the right axis node
128 + */
129 + public void setRightAxisNode(T rightAxisNode) {
130 + this.rightAxisNode = rightAxisNode;
131 + }
132 +}
1 +/*
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 + */
16 +package org.onosproject.yangutils.datamodel;
17 +
18 +import java.io.Serializable;
19 +import java.util.List;
20 +
21 +/**
22 + * Representation of data model node to maintain relative path defined in YANG path-arg.
23 + */
24 +public class YangRelativePath implements Serializable {
25 +
26 + private static final long serialVersionUID = 806201690L;
27 +
28 + // Relative path ancestor node count the number of node exist between current node to parent node.
29 + private int ancestorNodeCount;
30 +
31 + // Absolute path expression.
32 + private List<YangAtomicPath> atomicPathList;
33 +
34 + /**
35 + * Returns the absolute path.
36 + *
37 + * @return the absolute path
38 + */
39 + public List<YangAtomicPath> getAtomicPathList() {
40 + return atomicPathList;
41 + }
42 +
43 + /**
44 + * Sets the absolute path.
45 + *
46 + * @param atomicPathList Sets the absolute path
47 + */
48 + public void setAtomicPathList(List<YangAtomicPath> atomicPathList) {
49 + this.atomicPathList = atomicPathList;
50 + }
51 +
52 + /**
53 + * Returns the relative path ancestor count.
54 + *
55 + * @return the relative path ancestor count
56 + */
57 + public int getAncestorNodeCount() {
58 + return ancestorNodeCount;
59 + }
60 +
61 + /**
62 + * Sets the relative path ancestor count.
63 + *
64 + * @param ancestorNodeCount Sets the relative path ancestor count
65 + */
66 + public void setAncestorNodeCount(int ancestorNodeCount) {
67 + this.ancestorNodeCount = ancestorNodeCount;
68 + }
69 +}