Committed by
Patrick Liu
[ONOS-4829] Augmented data method generator implmentation.
Change-Id: I0cb68dd10a748e5b66eec0b832574f408a23ba5c
Showing
66 changed files
with
881 additions
and
412 deletions
| ... | @@ -15,8 +15,10 @@ | ... | @@ -15,8 +15,10 @@ |
| 15 | */ | 15 | */ |
| 16 | package org.onosproject.yangutils.datamodel; | 16 | package org.onosproject.yangutils.datamodel; |
| 17 | 17 | ||
| 18 | +import java.util.HashMap; | ||
| 18 | import java.util.LinkedList; | 19 | import java.util.LinkedList; |
| 19 | import java.util.List; | 20 | import java.util.List; |
| 21 | +import java.util.Map; | ||
| 20 | 22 | ||
| 21 | import org.onosproject.yangutils.datamodel.exceptions.DataModelException; | 23 | import org.onosproject.yangutils.datamodel.exceptions.DataModelException; |
| 22 | import org.onosproject.yangutils.datamodel.utils.Parsable; | 24 | import org.onosproject.yangutils.datamodel.utils.Parsable; |
| ... | @@ -83,7 +85,7 @@ import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCol | ... | @@ -83,7 +85,7 @@ import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCol |
| 83 | public class YangAugment | 85 | public class YangAugment |
| 84 | extends YangNode | 86 | extends YangNode |
| 85 | implements YangLeavesHolder, YangCommonInfo, Parsable, CollisionDetector, YangAugmentedInfo, Resolvable, | 87 | implements YangLeavesHolder, YangCommonInfo, Parsable, CollisionDetector, YangAugmentedInfo, Resolvable, |
| 86 | - YangXPathResolver, YangWhenHolder, YangIfFeatureHolder { | 88 | + YangXPathResolver, YangWhenHolder, YangIfFeatureHolder { |
| 87 | 89 | ||
| 88 | private static final long serialVersionUID = 806201602L; | 90 | private static final long serialVersionUID = 806201602L; |
| 89 | 91 | ||
| ... | @@ -128,9 +130,13 @@ public class YangAugment | ... | @@ -128,9 +130,13 @@ public class YangAugment |
| 128 | private YangNode augmentedNode; | 130 | private YangNode augmentedNode; |
| 129 | 131 | ||
| 130 | /** | 132 | /** |
| 131 | - * Status of resolution. If completely resolved enum value is "RESOLVED", | 133 | + * All resolved nodes in given xPath. |
| 132 | - * if not enum value is "UNRESOLVED", in case reference of grouping/typedef | 134 | + */ |
| 133 | - * is added to uses/type but it's not resolved value of enum should be | 135 | + private Map<YangAtomicPath, YangNode> resolveNodeInPath; |
| 136 | + | ||
| 137 | + /** | ||
| 138 | + * Status of resolution. If completely resolved enum value is "RESOLVED", if not enum value is "UNRESOLVED", in case | ||
| 139 | + * reference of grouping/typedef is added to uses/type but it's not resolved value of enum should be | ||
| 134 | * "INTRA_FILE_RESOLVED". | 140 | * "INTRA_FILE_RESOLVED". |
| 135 | */ | 141 | */ |
| 136 | private ResolvableStatus resolvableStatus; | 142 | private ResolvableStatus resolvableStatus; |
| ... | @@ -150,6 +156,7 @@ public class YangAugment | ... | @@ -150,6 +156,7 @@ public class YangAugment |
| 150 | */ | 156 | */ |
| 151 | public YangAugment() { | 157 | public YangAugment() { |
| 152 | super(YangNodeType.AUGMENT_NODE); | 158 | super(YangNodeType.AUGMENT_NODE); |
| 159 | + resolveNodeInPath = new HashMap<>(); | ||
| 153 | resolvableStatus = ResolvableStatus.UNRESOLVED; | 160 | resolvableStatus = ResolvableStatus.UNRESOLVED; |
| 154 | } | 161 | } |
| 155 | 162 | ||
| ... | @@ -411,6 +418,11 @@ public class YangAugment | ... | @@ -411,6 +418,11 @@ public class YangAugment |
| 411 | } | 418 | } |
| 412 | 419 | ||
| 413 | @Override | 420 | @Override |
| 421 | + public void setIfFeatureList(List<YangIfFeature> ifFeatureList) { | ||
| 422 | + this.ifFeatureList = ifFeatureList; | ||
| 423 | + } | ||
| 424 | + | ||
| 425 | + @Override | ||
| 414 | public void addIfFeatureList(YangIfFeature ifFeature) { | 426 | public void addIfFeatureList(YangIfFeature ifFeature) { |
| 415 | if (getIfFeatureList() == null) { | 427 | if (getIfFeatureList() == null) { |
| 416 | setIfFeatureList(new LinkedList<>()); | 428 | setIfFeatureList(new LinkedList<>()); |
| ... | @@ -419,11 +431,6 @@ public class YangAugment | ... | @@ -419,11 +431,6 @@ public class YangAugment |
| 419 | } | 431 | } |
| 420 | 432 | ||
| 421 | @Override | 433 | @Override |
| 422 | - public void setIfFeatureList(List<YangIfFeature> ifFeatureList) { | ||
| 423 | - this.ifFeatureList = ifFeatureList; | ||
| 424 | - } | ||
| 425 | - | ||
| 426 | - @Override | ||
| 427 | public ResolvableStatus getResolvableStatus() { | 434 | public ResolvableStatus getResolvableStatus() { |
| 428 | return resolvableStatus; | 435 | return resolvableStatus; |
| 429 | } | 436 | } |
| ... | @@ -438,4 +445,22 @@ public class YangAugment | ... | @@ -438,4 +445,22 @@ public class YangAugment |
| 438 | public void resolve() throws DataModelException { | 445 | public void resolve() throws DataModelException { |
| 439 | // Resolving of target node is being done in XPathLinker. | 446 | // Resolving of target node is being done in XPathLinker. |
| 440 | } | 447 | } |
| 448 | + | ||
| 449 | + /** | ||
| 450 | + * Returns all resolved node in path. | ||
| 451 | + * | ||
| 452 | + * @return all resolved node in path | ||
| 453 | + */ | ||
| 454 | + public Map<YangAtomicPath, YangNode> getResolveNodeInPath() { | ||
| 455 | + return resolveNodeInPath; | ||
| 456 | + } | ||
| 457 | + | ||
| 458 | + /** | ||
| 459 | + * Sets all resolved node in path. | ||
| 460 | + * | ||
| 461 | + * @param resolveNodeInPath all resolved node in path | ||
| 462 | + */ | ||
| 463 | + public void setResolveNodeInPath(Map<YangAtomicPath, YangNode> resolveNodeInPath) { | ||
| 464 | + this.resolveNodeInPath = resolveNodeInPath; | ||
| 465 | + } | ||
| 441 | } | 466 | } | ... | ... |
| ... | @@ -406,7 +406,7 @@ public class YangContainer | ... | @@ -406,7 +406,7 @@ public class YangContainer |
| 406 | * Sets the config's value to all leaf if leaf's config statement is not | 406 | * Sets the config's value to all leaf if leaf's config statement is not |
| 407 | * specified. | 407 | * specified. |
| 408 | * | 408 | * |
| 409 | - * @param leaves list of leaf attributes of container | 409 | + * @param leaves list of leaf attributes of container |
| 410 | * @param leafLists list of leaf-list attributes of container | 410 | * @param leafLists list of leaf-list attributes of container |
| 411 | */ | 411 | */ |
| 412 | private void setDefaultConfigValueToChild(List<YangLeaf> leaves, List<YangLeafList> leafLists) { | 412 | private void setDefaultConfigValueToChild(List<YangLeaf> leaves, List<YangLeafList> leafLists) { |
| ... | @@ -439,7 +439,7 @@ public class YangContainer | ... | @@ -439,7 +439,7 @@ public class YangContainer |
| 439 | /** | 439 | /** |
| 440 | * Validates config statement of container. | 440 | * Validates config statement of container. |
| 441 | * | 441 | * |
| 442 | - * @param leaves list of leaf attributes of container | 442 | + * @param leaves list of leaf attributes of container |
| 443 | * @param leafLists list of leaf-list attributes of container | 443 | * @param leafLists list of leaf-list attributes of container |
| 444 | * @throws DataModelException a violation of data model rules | 444 | * @throws DataModelException a violation of data model rules |
| 445 | */ | 445 | */ | ... | ... |
| ... | @@ -144,7 +144,6 @@ public class YangInput | ... | @@ -144,7 +144,6 @@ public class YangInput |
| 144 | listOfLeaf = leafsList; | 144 | listOfLeaf = leafsList; |
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | - | ||
| 148 | @Override | 147 | @Override |
| 149 | public void addLeaf(YangLeaf leaf) { | 148 | public void addLeaf(YangLeaf leaf) { |
| 150 | getListOfLeaf().add(leaf); | 149 | getListOfLeaf().add(leaf); | ... | ... |
| ... | @@ -158,7 +158,6 @@ public class YangOutput | ... | @@ -158,7 +158,6 @@ public class YangOutput |
| 158 | this.listOfLeafList = listOfLeafList; | 158 | this.listOfLeafList = listOfLeafList; |
| 159 | } | 159 | } |
| 160 | 160 | ||
| 161 | - | ||
| 162 | @Override | 161 | @Override |
| 163 | public void addLeafList(YangLeafList leafList) { | 162 | public void addLeafList(YangLeafList leafList) { |
| 164 | getListOfLeafList().add(leafList); | 163 | getListOfLeafList().add(leafList); | ... | ... |
| ... | @@ -349,6 +349,7 @@ public final class DataModelUtils { | ... | @@ -349,6 +349,7 @@ public final class DataModelUtils { |
| 349 | * type info needs to be updated to the cloned new type node. | 349 | * type info needs to be updated to the cloned new type node. |
| 350 | * | 350 | * |
| 351 | * @param leavesHolder cloned leaves holder, for whom the leaves reference needs to be updated | 351 | * @param leavesHolder cloned leaves holder, for whom the leaves reference needs to be updated |
| 352 | + * @throws DataModelException when fails to do data model operations | ||
| 352 | */ | 353 | */ |
| 353 | public static void updateClonedLeavesUnionEnumRef(YangLeavesHolder leavesHolder) throws DataModelException { | 354 | public static void updateClonedLeavesUnionEnumRef(YangLeavesHolder leavesHolder) throws DataModelException { |
| 354 | List<YangLeaf> currentListOfLeaves = leavesHolder.getListOfLeaf(); | 355 | List<YangLeaf> currentListOfLeaves = leavesHolder.getListOfLeaf(); | ... | ... |
| ... | @@ -14,7 +14,7 @@ | ... | @@ -14,7 +14,7 @@ |
| 14 | ~ limitations under the License. | 14 | ~ limitations under the License. |
| 15 | --> | 15 | --> |
| 16 | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | 16 | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 17 | - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | 17 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| 18 | <modelVersion>4.0.0</modelVersion> | 18 | <modelVersion>4.0.0</modelVersion> |
| 19 | 19 | ||
| 20 | <parent> | 20 | <parent> |
| ... | @@ -33,7 +33,7 @@ | ... | @@ -33,7 +33,7 @@ |
| 33 | </properties> | 33 | </properties> |
| 34 | 34 | ||
| 35 | <dependencies> | 35 | <dependencies> |
| 36 | - <dependency> | 36 | + <dependency> |
| 37 | <groupId>org.onosproject</groupId> | 37 | <groupId>org.onosproject</groupId> |
| 38 | <artifactId>yangutils-datamodel</artifactId> | 38 | <artifactId>yangutils-datamodel</artifactId> |
| 39 | <version>1.7.0-SNAPSHOT</version> | 39 | <version>1.7.0-SNAPSHOT</version> | ... | ... |
utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/linker/impl/PrefixResolverType.java
0 → 100644
| 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 | + | ||
| 17 | +package org.onosproject.yangutils.linker.impl; | ||
| 18 | + | ||
| 19 | +/** | ||
| 20 | + * Enum for prefix resolver type when augment has come in path. | ||
| 21 | + */ | ||
| 22 | +public enum PrefixResolverType { | ||
| 23 | + | ||
| 24 | + /** | ||
| 25 | + * When prefix changes from inter file to intra file. | ||
| 26 | + */ | ||
| 27 | + INTER_TO_INTRA, | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * When prefix changes from intra file to inter file. | ||
| 31 | + */ | ||
| 32 | + INTRA_TO_INTER, | ||
| 33 | + | ||
| 34 | + /** | ||
| 35 | + * When prefix changes from one inter file to other inter file. | ||
| 36 | + */ | ||
| 37 | + INTER_TO_INTER, | ||
| 38 | + | ||
| 39 | + /** | ||
| 40 | + * When no prefix change occurres. | ||
| 41 | + */ | ||
| 42 | + NO_PREFIX_CHANGE_FOR_INTRA, | ||
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * When no prefix change occurres. | ||
| 46 | + */ | ||
| 47 | + NO_PREFIX_CHANGE_FOR_INTER | ||
| 48 | +} |
| ... | @@ -21,6 +21,7 @@ import java.util.List; | ... | @@ -21,6 +21,7 @@ import java.util.List; |
| 21 | import org.onosproject.yangutils.datamodel.YangAugment; | 21 | import org.onosproject.yangutils.datamodel.YangAugment; |
| 22 | import org.onosproject.yangutils.datamodel.YangAugmentableNode; | 22 | import org.onosproject.yangutils.datamodel.YangAugmentableNode; |
| 23 | import org.onosproject.yangutils.datamodel.YangAugmentedInfo; | 23 | import org.onosproject.yangutils.datamodel.YangAugmentedInfo; |
| 24 | +import org.onosproject.yangutils.datamodel.YangChoice; | ||
| 24 | import org.onosproject.yangutils.datamodel.YangLeaf; | 25 | import org.onosproject.yangutils.datamodel.YangLeaf; |
| 25 | import org.onosproject.yangutils.datamodel.YangLeafList; | 26 | import org.onosproject.yangutils.datamodel.YangLeafList; |
| 26 | import org.onosproject.yangutils.datamodel.YangLeavesHolder; | 27 | import org.onosproject.yangutils.datamodel.YangLeavesHolder; |
| ... | @@ -36,8 +37,7 @@ public final class YangLinkerUtils { | ... | @@ -36,8 +37,7 @@ public final class YangLinkerUtils { |
| 36 | } | 37 | } |
| 37 | 38 | ||
| 38 | /** | 39 | /** |
| 39 | - * Detects collision between target nodes leaf/leaf-list or child node with | 40 | + * Detects collision between target nodes leaf/leaf-list or child node with augmented leaf/leaf-list or child node. |
| 40 | - * augmented leaf/leaf-list or child node. | ||
| 41 | * | 41 | * |
| 42 | * @param targetNode target node | 42 | * @param targetNode target node |
| 43 | * @param augment augment node | 43 | * @param augment augment node |
| ... | @@ -46,57 +46,66 @@ public final class YangLinkerUtils { | ... | @@ -46,57 +46,66 @@ public final class YangLinkerUtils { |
| 46 | YangNode targetNodesChild = targetNode.getChild(); | 46 | YangNode targetNodesChild = targetNode.getChild(); |
| 47 | YangNode augmentsChild = augment.getChild(); | 47 | YangNode augmentsChild = augment.getChild(); |
| 48 | YangLeavesHolder augmentsLeavesHolder = augment; | 48 | YangLeavesHolder augmentsLeavesHolder = augment; |
| 49 | - YangLeavesHolder targetNodesLeavesHolder = (YangLeavesHolder) targetNode; | 49 | + if (targetNode instanceof YangChoice) { |
| 50 | - | 50 | + if (augmentsLeavesHolder.getListOfLeaf() != null |
| 51 | - YangNode parent = targetNode; | 51 | + || augmentsLeavesHolder.getListOfLeafList() != null) { |
| 52 | - if (targetNode instanceof YangAugment) { | 52 | + throw new LinkerException("target node " + targetNode.getName() |
| 53 | - parent = targetNode.getParent(); | 53 | + + "is a instance of choice. it can " + |
| 54 | + "only be augmented with leaf using a case node."); | ||
| 55 | + } | ||
| 54 | } else { | 56 | } else { |
| 55 | - while (parent.getParent() != null) { | 57 | + YangLeavesHolder targetNodesLeavesHolder = (YangLeavesHolder) targetNode; |
| 56 | - parent = parent.getParent(); | 58 | + |
| 59 | + YangNode parent = targetNode; | ||
| 60 | + if (targetNode instanceof YangAugment) { | ||
| 61 | + parent = targetNode.getParent(); | ||
| 62 | + } else { | ||
| 63 | + while (parent.getParent() != null) { | ||
| 64 | + parent = parent.getParent(); | ||
| 65 | + } | ||
| 57 | } | 66 | } |
| 58 | - } | 67 | + if (augmentsLeavesHolder.getListOfLeaf() != null && augmentsLeavesHolder.getListOfLeaf().size() != 0 |
| 59 | - if (augmentsLeavesHolder.getListOfLeaf() != null && augmentsLeavesHolder.getListOfLeaf().size() != 0 | 68 | + && targetNodesLeavesHolder.getListOfLeaf() != null) { |
| 60 | - && targetNodesLeavesHolder.getListOfLeaf() != null) { | 69 | + for (YangLeaf leaf : augmentsLeavesHolder.getListOfLeaf()) { |
| 61 | - for (YangLeaf leaf : augmentsLeavesHolder.getListOfLeaf()) { | 70 | + for (YangLeaf targetLeaf : targetNodesLeavesHolder.getListOfLeaf()) { |
| 62 | - for (YangLeaf targetLeaf : targetNodesLeavesHolder.getListOfLeaf()) { | 71 | + if (targetLeaf.getName().equals(leaf.getName())) { |
| 63 | - if (targetLeaf.getName().equals(leaf.getName())) { | 72 | + throw new LinkerException("target node " + targetNode.getName() |
| 64 | - throw new LinkerException("target node " + targetNode.getName() | 73 | + + " contains augmented leaf " + leaf.getName() + " in module " |
| 65 | - + " contains augmented leaf " + leaf.getName() + " in module " | 74 | + + parent.getName()); |
| 66 | - + parent.getName()); | 75 | + } |
| 67 | } | 76 | } |
| 68 | } | 77 | } |
| 69 | - } | 78 | + } else if (augmentsLeavesHolder.getListOfLeafList() != null |
| 70 | - } else if (augmentsLeavesHolder.getListOfLeafList() != null | 79 | + && augmentsLeavesHolder.getListOfLeafList().size() != 0 |
| 71 | - && augmentsLeavesHolder.getListOfLeafList().size() != 0 | 80 | + && targetNodesLeavesHolder.getListOfLeafList() != null) { |
| 72 | - && targetNodesLeavesHolder.getListOfLeafList() != null) { | 81 | + for (YangLeafList leafList : augmentsLeavesHolder.getListOfLeafList()) { |
| 73 | - for (YangLeafList leafList : augmentsLeavesHolder.getListOfLeafList()) { | 82 | + for (YangLeafList targetLeafList : targetNodesLeavesHolder.getListOfLeafList()) { |
| 74 | - for (YangLeafList targetLeafList : targetNodesLeavesHolder.getListOfLeafList()) { | 83 | + if (targetLeafList.getName().equals(leafList.getName())) { |
| 75 | - if (targetLeafList.getName().equals(leafList.getName())) { | 84 | + throw new LinkerException("target node " + targetNode.getName() |
| 76 | - throw new LinkerException("target node " + targetNode.getName() | 85 | + + " contains augmented leaf-list" + leafList.getName() + " in module " |
| 77 | - + " contains augmented leaf-list" + leafList.getName() + " in module " | 86 | + + parent.getName()); |
| 78 | - + parent.getName()); | 87 | + } |
| 79 | } | 88 | } |
| 80 | } | 89 | } |
| 81 | - } | 90 | + } else { |
| 82 | - } else { | 91 | + while (augmentsChild != null) { |
| 83 | - while (augmentsChild != null) { | 92 | + while (targetNodesChild != null) { |
| 84 | - while (targetNodesChild != null) { | 93 | + if (targetNodesChild.getName().equals(augmentsChild.getName())) { |
| 85 | - if (targetNodesChild.getName().equals(augmentsChild.getName())) { | 94 | + throw new LinkerException("target node " + targetNode.getName() |
| 86 | - throw new LinkerException("target node " + targetNode.getName() | 95 | + + " contains augmented child node" + augmentsChild.getName() + " in module " |
| 87 | - + " contains augmented child node" + augmentsChild.getName() + " in module " | 96 | + + parent.getName()); |
| 88 | - + parent.getName()); | 97 | + } |
| 98 | + targetNodesChild = targetNodesChild.getNextSibling(); | ||
| 89 | } | 99 | } |
| 90 | - targetNodesChild = targetNodesChild.getNextSibling(); | 100 | + augmentsChild = augmentsChild.getNextSibling(); |
| 91 | } | 101 | } |
| 92 | - augmentsChild = augmentsChild.getNextSibling(); | ||
| 93 | } | 102 | } |
| 94 | } | 103 | } |
| 95 | } | 104 | } |
| 96 | 105 | ||
| 97 | /** | 106 | /** |
| 98 | - * Detects collision between target nodes and its all leaf/leaf-list or child node with | 107 | + * Detects collision between target nodes and its all leaf/leaf-list or child node with augmented leaf/leaf-list or |
| 99 | - * augmented leaf/leaf-list or child node. | 108 | + * child node. |
| 100 | * | 109 | * |
| 101 | * @param targetNode target node | 110 | * @param targetNode target node |
| 102 | * @param augment augment node | 111 | * @param augment augment node | ... | ... |
| ... | @@ -32,9 +32,9 @@ import org.onosproject.yangutils.datamodel.YangEntityToResolveInfo; | ... | @@ -32,9 +32,9 @@ import org.onosproject.yangutils.datamodel.YangEntityToResolveInfo; |
| 32 | import org.onosproject.yangutils.datamodel.YangFeature; | 32 | import org.onosproject.yangutils.datamodel.YangFeature; |
| 33 | import org.onosproject.yangutils.datamodel.YangFeatureHolder; | 33 | import org.onosproject.yangutils.datamodel.YangFeatureHolder; |
| 34 | import org.onosproject.yangutils.datamodel.YangGrouping; | 34 | import org.onosproject.yangutils.datamodel.YangGrouping; |
| 35 | -import org.onosproject.yangutils.datamodel.YangIfFeature; | ||
| 36 | import org.onosproject.yangutils.datamodel.YangIdentity; | 35 | import org.onosproject.yangutils.datamodel.YangIdentity; |
| 37 | import org.onosproject.yangutils.datamodel.YangIdentityRef; | 36 | import org.onosproject.yangutils.datamodel.YangIdentityRef; |
| 37 | +import org.onosproject.yangutils.datamodel.YangIfFeature; | ||
| 38 | import org.onosproject.yangutils.datamodel.YangImport; | 38 | import org.onosproject.yangutils.datamodel.YangImport; |
| 39 | import org.onosproject.yangutils.datamodel.YangInclude; | 39 | import org.onosproject.yangutils.datamodel.YangInclude; |
| 40 | import org.onosproject.yangutils.datamodel.YangInput; | 40 | import org.onosproject.yangutils.datamodel.YangInput; |
| ... | @@ -73,16 +73,16 @@ import static org.onosproject.yangutils.datamodel.utils.ResolvableStatus.UNRESOL | ... | @@ -73,16 +73,16 @@ import static org.onosproject.yangutils.datamodel.utils.ResolvableStatus.UNRESOL |
| 73 | import static org.onosproject.yangutils.linker.YangLinkingPhase.INTER_FILE; | 73 | import static org.onosproject.yangutils.linker.YangLinkingPhase.INTER_FILE; |
| 74 | import static org.onosproject.yangutils.linker.YangLinkingPhase.INTRA_FILE; | 74 | import static org.onosproject.yangutils.linker.YangLinkingPhase.INTRA_FILE; |
| 75 | import static org.onosproject.yangutils.linker.impl.YangLinkerUtils.detectCollisionForAugmentedNode; | 75 | import static org.onosproject.yangutils.linker.impl.YangLinkerUtils.detectCollisionForAugmentedNode; |
| 76 | +import static org.onosproject.yangutils.utils.UtilConstants.BASE_LINKER_ERROR; | ||
| 76 | import static org.onosproject.yangutils.utils.UtilConstants.FEATURE_LINKER_ERROR; | 77 | import static org.onosproject.yangutils.utils.UtilConstants.FEATURE_LINKER_ERROR; |
| 77 | import static org.onosproject.yangutils.utils.UtilConstants.GROUPING_LINKER_ERROR; | 78 | import static org.onosproject.yangutils.utils.UtilConstants.GROUPING_LINKER_ERROR; |
| 79 | +import static org.onosproject.yangutils.utils.UtilConstants.IDENTITYREF; | ||
| 80 | +import static org.onosproject.yangutils.utils.UtilConstants.IDENTITYREF_LINKER_ERROR; | ||
| 78 | import static org.onosproject.yangutils.utils.UtilConstants.INPUT; | 81 | import static org.onosproject.yangutils.utils.UtilConstants.INPUT; |
| 79 | import static org.onosproject.yangutils.utils.UtilConstants.LEAFREF; | 82 | import static org.onosproject.yangutils.utils.UtilConstants.LEAFREF; |
| 80 | -import static org.onosproject.yangutils.utils.UtilConstants.IDENTITYREF; | ||
| 81 | import static org.onosproject.yangutils.utils.UtilConstants.LEAFREF_LINKER_ERROR; | 83 | import static org.onosproject.yangutils.utils.UtilConstants.LEAFREF_LINKER_ERROR; |
| 82 | import static org.onosproject.yangutils.utils.UtilConstants.OUTPUT; | 84 | import static org.onosproject.yangutils.utils.UtilConstants.OUTPUT; |
| 83 | import static org.onosproject.yangutils.utils.UtilConstants.TYPEDEF_LINKER_ERROR; | 85 | import static org.onosproject.yangutils.utils.UtilConstants.TYPEDEF_LINKER_ERROR; |
| 84 | -import static org.onosproject.yangutils.utils.UtilConstants.IDENTITYREF_LINKER_ERROR; | ||
| 85 | -import static org.onosproject.yangutils.utils.UtilConstants.BASE_LINKER_ERROR; | ||
| 86 | 86 | ||
| 87 | /** | 87 | /** |
| 88 | * Represents implementation of resolution object which will be resolved by | 88 | * Represents implementation of resolution object which will be resolved by |
| ... | @@ -128,7 +128,6 @@ public class YangResolutionInfoImpl<T> | ... | @@ -128,7 +128,6 @@ public class YangResolutionInfoImpl<T> |
| 128 | */ | 128 | */ |
| 129 | @SuppressWarnings("unused") | 129 | @SuppressWarnings("unused") |
| 130 | private YangResolutionInfoImpl() { | 130 | private YangResolutionInfoImpl() { |
| 131 | - | ||
| 132 | } | 131 | } |
| 133 | 132 | ||
| 134 | /** | 133 | /** |
| ... | @@ -153,7 +152,6 @@ public class YangResolutionInfoImpl<T> | ... | @@ -153,7 +152,6 @@ public class YangResolutionInfoImpl<T> |
| 153 | throws DataModelException { | 152 | throws DataModelException { |
| 154 | 153 | ||
| 155 | setCurReferenceResolver(dataModelRootNode); | 154 | setCurReferenceResolver(dataModelRootNode); |
| 156 | - | ||
| 157 | /** | 155 | /** |
| 158 | * Current node to resolve, it can be a YANG type, YANG uses or YANG if-feature or | 156 | * Current node to resolve, it can be a YANG type, YANG uses or YANG if-feature or |
| 159 | * YANG leafref or YANG base or YANG identityref. | 157 | * YANG leafref or YANG base or YANG identityref. |
| ... | @@ -173,7 +171,6 @@ public class YangResolutionInfoImpl<T> | ... | @@ -173,7 +171,6 @@ public class YangResolutionInfoImpl<T> |
| 173 | throw new DataModelException("Data Model Exception: Entity to resolved is other than " + | 171 | throw new DataModelException("Data Model Exception: Entity to resolved is other than " + |
| 174 | "type/uses/if-feature/leafref/base/identityref"); | 172 | "type/uses/if-feature/leafref/base/identityref"); |
| 175 | } | 173 | } |
| 176 | - | ||
| 177 | // Push the initial entity to resolve in stack. | 174 | // Push the initial entity to resolve in stack. |
| 178 | addInPartialResolvedStack(getEntityToResolveInfo()); | 175 | addInPartialResolvedStack(getEntityToResolveInfo()); |
| 179 | 176 | ||
| ... | @@ -191,7 +188,6 @@ public class YangResolutionInfoImpl<T> | ... | @@ -191,7 +188,6 @@ public class YangResolutionInfoImpl<T> |
| 191 | throws DataModelException { | 188 | throws DataModelException { |
| 192 | 189 | ||
| 193 | while (getPartialResolvedStack().size() != 0) { | 190 | while (getPartialResolvedStack().size() != 0) { |
| 194 | - | ||
| 195 | /** | 191 | /** |
| 196 | * Current node to resolve, it can be a YANG type or YANG uses or | 192 | * Current node to resolve, it can be a YANG type or YANG uses or |
| 197 | * YANG if-feature or YANG leafref or YANG base or YANG identityref. | 193 | * YANG if-feature or YANG leafref or YANG base or YANG identityref. |
| ... | @@ -1479,6 +1475,7 @@ public class YangResolutionInfoImpl<T> | ... | @@ -1479,6 +1475,7 @@ public class YangResolutionInfoImpl<T> |
| 1479 | detectCollisionForAugmentedNode(targetNode, augment); | 1475 | detectCollisionForAugmentedNode(targetNode, augment); |
| 1480 | ((YangAugmentableNode) targetNode).addAugmentation(augment); | 1476 | ((YangAugmentableNode) targetNode).addAugmentation(augment); |
| 1481 | augment.setAugmentedNode(targetNode); | 1477 | augment.setAugmentedNode(targetNode); |
| 1478 | + augment.setResolveNodeInPath(xPathLinker.getResolvedNodes()); | ||
| 1482 | Resolvable resolvable = (Resolvable) entityToResolve; | 1479 | Resolvable resolvable = (Resolvable) entityToResolve; |
| 1483 | resolvable.setResolvableStatus(RESOLVED); | 1480 | resolvable.setResolvableStatus(RESOLVED); |
| 1484 | } else { | 1481 | } else { | ... | ... |
This diff is collapsed. Click to expand it.
utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaImportData.java
| ... | @@ -21,11 +21,14 @@ import java.util.SortedSet; | ... | @@ -21,11 +21,14 @@ import java.util.SortedSet; |
| 21 | import java.util.TreeSet; | 21 | import java.util.TreeSet; |
| 22 | 22 | ||
| 23 | import static org.onosproject.yangutils.utils.UtilConstants.ABSTRACT_EVENT; | 23 | import static org.onosproject.yangutils.utils.UtilConstants.ABSTRACT_EVENT; |
| 24 | +import static org.onosproject.yangutils.utils.UtilConstants.YANG_AUGMENTED_INFO_CLASS_IMPORT_CLASS; | ||
| 25 | +import static org.onosproject.yangutils.utils.UtilConstants.YANG_AUGMENTED_INFO_CLASS_IMPORT_PKG; | ||
| 24 | import static org.onosproject.yangutils.utils.UtilConstants.COLLECTION_IMPORTS; | 26 | import static org.onosproject.yangutils.utils.UtilConstants.COLLECTION_IMPORTS; |
| 25 | import static org.onosproject.yangutils.utils.UtilConstants.EMPTY_STRING; | 27 | import static org.onosproject.yangutils.utils.UtilConstants.EMPTY_STRING; |
| 26 | import static org.onosproject.yangutils.utils.UtilConstants.EVENT_LISTENER; | 28 | import static org.onosproject.yangutils.utils.UtilConstants.EVENT_LISTENER; |
| 27 | import static org.onosproject.yangutils.utils.UtilConstants.GOOGLE_MORE_OBJECT_IMPORT_CLASS; | 29 | import static org.onosproject.yangutils.utils.UtilConstants.GOOGLE_MORE_OBJECT_IMPORT_CLASS; |
| 28 | import static org.onosproject.yangutils.utils.UtilConstants.GOOGLE_MORE_OBJECT_IMPORT_PKG; | 30 | import static org.onosproject.yangutils.utils.UtilConstants.GOOGLE_MORE_OBJECT_IMPORT_PKG; |
| 31 | +import static org.onosproject.yangutils.utils.UtilConstants.HASH_MAP; | ||
| 29 | import static org.onosproject.yangutils.utils.UtilConstants.IMPORT; | 32 | import static org.onosproject.yangutils.utils.UtilConstants.IMPORT; |
| 30 | import static org.onosproject.yangutils.utils.UtilConstants.JAVA_LANG; | 33 | import static org.onosproject.yangutils.utils.UtilConstants.JAVA_LANG; |
| 31 | import static org.onosproject.yangutils.utils.UtilConstants.JAVA_UTIL_OBJECTS_IMPORT_CLASS; | 34 | import static org.onosproject.yangutils.utils.UtilConstants.JAVA_UTIL_OBJECTS_IMPORT_CLASS; |
| ... | @@ -33,6 +36,7 @@ import static org.onosproject.yangutils.utils.UtilConstants.JAVA_UTIL_OBJECTS_IM | ... | @@ -33,6 +36,7 @@ import static org.onosproject.yangutils.utils.UtilConstants.JAVA_UTIL_OBJECTS_IM |
| 33 | import static org.onosproject.yangutils.utils.UtilConstants.LIST; | 36 | import static org.onosproject.yangutils.utils.UtilConstants.LIST; |
| 34 | import static org.onosproject.yangutils.utils.UtilConstants.LISTENER_REG; | 37 | import static org.onosproject.yangutils.utils.UtilConstants.LISTENER_REG; |
| 35 | import static org.onosproject.yangutils.utils.UtilConstants.LISTENER_SERVICE; | 38 | import static org.onosproject.yangutils.utils.UtilConstants.LISTENER_SERVICE; |
| 39 | +import static org.onosproject.yangutils.utils.UtilConstants.MAP; | ||
| 36 | import static org.onosproject.yangutils.utils.UtilConstants.NEW_LINE; | 40 | import static org.onosproject.yangutils.utils.UtilConstants.NEW_LINE; |
| 37 | import static org.onosproject.yangutils.utils.UtilConstants.ONOS_EVENT_PKG; | 41 | import static org.onosproject.yangutils.utils.UtilConstants.ONOS_EVENT_PKG; |
| 38 | import static org.onosproject.yangutils.utils.UtilConstants.PERIOD; | 42 | import static org.onosproject.yangutils.utils.UtilConstants.PERIOD; |
| ... | @@ -248,4 +252,31 @@ public class JavaImportData { | ... | @@ -248,4 +252,31 @@ public class JavaImportData { |
| 248 | public String getEventListenerImport() { | 252 | public String getEventListenerImport() { |
| 249 | return IMPORT + ONOS_EVENT_PKG + PERIOD + EVENT_LISTENER + SEMI_COLAN + NEW_LINE; | 253 | return IMPORT + ONOS_EVENT_PKG + PERIOD + EVENT_LISTENER + SEMI_COLAN + NEW_LINE; |
| 250 | } | 254 | } |
| 255 | + | ||
| 256 | + /** | ||
| 257 | + * Returns import string for map class. | ||
| 258 | + * | ||
| 259 | + * @return import string for map class | ||
| 260 | + */ | ||
| 261 | + public String getMapImport() { | ||
| 262 | + return IMPORT + COLLECTION_IMPORTS + PERIOD + MAP + SEMI_COLAN + NEW_LINE; | ||
| 263 | + } | ||
| 264 | + | ||
| 265 | + /** | ||
| 266 | + * Returns import string for hash map class. | ||
| 267 | + * | ||
| 268 | + * @return import string for hash map class | ||
| 269 | + */ | ||
| 270 | + public String getHashMapImport() { | ||
| 271 | + return IMPORT + COLLECTION_IMPORTS + PERIOD + HASH_MAP + SEMI_COLAN + NEW_LINE; | ||
| 272 | + } | ||
| 273 | + | ||
| 274 | + /** | ||
| 275 | + * Returns import string for hash map class. | ||
| 276 | + * | ||
| 277 | + * @return import string for hash map class | ||
| 278 | + */ | ||
| 279 | + public String getYangAugmentedInfoImport() { | ||
| 280 | + return IMPORT + YANG_AUGMENTED_INFO_CLASS_IMPORT_PKG + PERIOD + YANG_AUGMENTED_INFO_CLASS_IMPORT_CLASS; | ||
| 281 | + } | ||
| 251 | } | 282 | } | ... | ... |
| ... | @@ -189,8 +189,6 @@ public class TempJavaCodeFragmentFiles { | ... | @@ -189,8 +189,6 @@ public class TempJavaCodeFragmentFiles { |
| 189 | if (fileType == GENERATE_ENUM_CLASS) { | 189 | if (fileType == GENERATE_ENUM_CLASS) { |
| 190 | getEnumerationTempFiles().generateJavaFile(GENERATE_ENUM_CLASS, curNode); | 190 | getEnumerationTempFiles().generateJavaFile(GENERATE_ENUM_CLASS, curNode); |
| 191 | } | 191 | } |
| 192 | - | ||
| 193 | - freeTemporaryResources(false); | ||
| 194 | } | 192 | } |
| 195 | 193 | ||
| 196 | /** | 194 | /** | ... | ... |
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
| ... | @@ -332,7 +332,7 @@ public class TempJavaTypeFragmentFiles | ... | @@ -332,7 +332,7 @@ public class TempJavaTypeFragmentFiles |
| 332 | * Creates type def class file. | 332 | * Creates type def class file. |
| 333 | */ | 333 | */ |
| 334 | if ((fileType & GENERATE_TYPEDEF_CLASS) != 0) { | 334 | if ((fileType & GENERATE_TYPEDEF_CLASS) != 0) { |
| 335 | - addImportsToStringAndHasCodeMethods(curNode, imports); | 335 | + addImportsToStringAndHasCodeMethods(imports); |
| 336 | setTypedefClassJavaFileHandle(getJavaFileHandle(getJavaClassName(TYPEDEF_CLASS_FILE_NAME_SUFFIX))); | 336 | setTypedefClassJavaFileHandle(getJavaFileHandle(getJavaClassName(TYPEDEF_CLASS_FILE_NAME_SUFFIX))); |
| 337 | generateTypeDefClassFile(getTypedefClassJavaFileHandle(), curNode, imports); | 337 | generateTypeDefClassFile(getTypedefClassJavaFileHandle(), curNode, imports); |
| 338 | } | 338 | } |
| ... | @@ -340,7 +340,7 @@ public class TempJavaTypeFragmentFiles | ... | @@ -340,7 +340,7 @@ public class TempJavaTypeFragmentFiles |
| 340 | * Creates type class file. | 340 | * Creates type class file. |
| 341 | */ | 341 | */ |
| 342 | if ((fileType & GENERATE_UNION_CLASS) != 0) { | 342 | if ((fileType & GENERATE_UNION_CLASS) != 0) { |
| 343 | - addImportsToStringAndHasCodeMethods(curNode, imports); | 343 | + addImportsToStringAndHasCodeMethods(imports); |
| 344 | setTypeClassJavaFileHandle(getJavaFileHandle(getJavaClassName(UNION_TYPE_CLASS_FILE_NAME_SUFFIX))); | 344 | setTypeClassJavaFileHandle(getJavaFileHandle(getJavaClassName(UNION_TYPE_CLASS_FILE_NAME_SUFFIX))); |
| 345 | generateUnionClassFile(getTypeClassJavaFileHandle(), curNode, imports); | 345 | generateUnionClassFile(getTypeClassJavaFileHandle(), curNode, imports); |
| 346 | } | 346 | } | ... | ... |
This diff is collapsed. Click to expand it.
| ... | @@ -34,7 +34,7 @@ import org.onosproject.yangutils.translator.tojava.JavaFileInfo; | ... | @@ -34,7 +34,7 @@ import org.onosproject.yangutils.translator.tojava.JavaFileInfo; |
| 34 | import org.onosproject.yangutils.translator.tojava.JavaFileInfoContainer; | 34 | import org.onosproject.yangutils.translator.tojava.JavaFileInfoContainer; |
| 35 | import org.onosproject.yangutils.utils.io.impl.YangToJavaNamingConflictUtil; | 35 | import org.onosproject.yangutils.utils.io.impl.YangToJavaNamingConflictUtil; |
| 36 | 36 | ||
| 37 | -import static org.onosproject.yangutils.translator.tojava.javamodel.YangJavaModelUtils.getCurNodePackage; | 37 | +import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.getCurNodePackage; |
| 38 | import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.getRootPackage; | 38 | import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.getRootPackage; |
| 39 | import static org.onosproject.yangutils.utils.UtilConstants.BIG_INTEGER; | 39 | import static org.onosproject.yangutils.utils.UtilConstants.BIG_INTEGER; |
| 40 | import static org.onosproject.yangutils.utils.UtilConstants.BIG_DECIMAL; | 40 | import static org.onosproject.yangutils.utils.UtilConstants.BIG_DECIMAL; | ... | ... |
| ... | @@ -30,7 +30,8 @@ import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles; | ... | @@ -30,7 +30,8 @@ import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles; |
| 30 | import org.onosproject.yangutils.utils.io.impl.YangPluginConfig; | 30 | import org.onosproject.yangutils.utils.io.impl.YangPluginConfig; |
| 31 | 31 | ||
| 32 | import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER; | 32 | import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER; |
| 33 | -import static org.onosproject.yangutils.translator.tojava.javamodel.YangJavaModelUtils.generateCodeOfAugmentableNode; | 33 | +import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.generateCodeOfAugmentableNode; |
| 34 | +import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCamelCase; | ||
| 34 | import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCapitalCase; | 35 | import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCapitalCase; |
| 35 | 36 | ||
| 36 | /** | 37 | /** |
| ... | @@ -154,10 +155,11 @@ public class YangJavaAugment | ... | @@ -154,10 +155,11 @@ public class YangJavaAugment |
| 154 | */ | 155 | */ |
| 155 | public String getAugmentClassName() { | 156 | public String getAugmentClassName() { |
| 156 | YangNodeIdentifier nodeId = getTargetNode().get(getTargetNode().size() - 1).getNodeIdentifier(); | 157 | YangNodeIdentifier nodeId = getTargetNode().get(getTargetNode().size() - 1).getNodeIdentifier(); |
| 158 | + String name = getCapitalCase(getCamelCase(nodeId.getName(), null)); | ||
| 157 | if (nodeId.getPrefix() != null) { | 159 | if (nodeId.getPrefix() != null) { |
| 158 | - return AUGMENTED + getCapitalCase(nodeId.getPrefix()) + getCapitalCase(nodeId.getName()); | 160 | + return AUGMENTED + getCapitalCase(nodeId.getPrefix()) + name; |
| 159 | } else { | 161 | } else { |
| 160 | - return AUGMENTED + getCapitalCase(nodeId.getName()); | 162 | + return AUGMENTED + name; |
| 161 | } | 163 | } |
| 162 | } | 164 | } |
| 163 | 165 | ||
| ... | @@ -173,7 +175,7 @@ public class YangJavaAugment | ... | @@ -173,7 +175,7 @@ public class YangJavaAugment |
| 173 | /** | 175 | /** |
| 174 | * Sets extended class info. | 176 | * Sets extended class info. |
| 175 | * | 177 | * |
| 176 | - * @param augmentedInfo extended class info | 178 | + * @param augmentedInfo extended class info |
| 177 | */ | 179 | */ |
| 178 | private void setExtendedClassInfo(List<JavaQualifiedTypeInfo> augmentedInfo) { | 180 | private void setExtendedClassInfo(List<JavaQualifiedTypeInfo> augmentedInfo) { |
| 179 | extendedClassInfo = augmentedInfo; | 181 | extendedClassInfo = augmentedInfo; | ... | ... |
| ... | @@ -26,7 +26,7 @@ import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles; | ... | @@ -26,7 +26,7 @@ import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles; |
| 26 | import org.onosproject.yangutils.utils.io.impl.YangPluginConfig; | 26 | import org.onosproject.yangutils.utils.io.impl.YangPluginConfig; |
| 27 | 27 | ||
| 28 | import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER; | 28 | import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER; |
| 29 | -import static org.onosproject.yangutils.translator.tojava.javamodel.YangJavaModelUtils.generateCodeOfAugmentableNode; | 29 | +import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.generateCodeOfAugmentableNode; |
| 30 | 30 | ||
| 31 | /** | 31 | /** |
| 32 | * Represents case information extended to support java code generation. | 32 | * Represents case information extended to support java code generation. | ... | ... |
| ... | @@ -26,7 +26,7 @@ import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles; | ... | @@ -26,7 +26,7 @@ import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles; |
| 26 | import org.onosproject.yangutils.utils.io.impl.YangPluginConfig; | 26 | import org.onosproject.yangutils.utils.io.impl.YangPluginConfig; |
| 27 | 27 | ||
| 28 | import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.INTERFACE_MASK; | 28 | import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.INTERFACE_MASK; |
| 29 | -import static org.onosproject.yangutils.translator.tojava.javamodel.YangJavaModelUtils.generateCodeAndUpdateInParent; | 29 | +import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.generateCodeAndUpdateInParent; |
| 30 | 30 | ||
| 31 | /** | 31 | /** |
| 32 | * Represents choice information extended to support java code generation. | 32 | * Represents choice information extended to support java code generation. | ... | ... |
| ... | @@ -26,7 +26,7 @@ import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles; | ... | @@ -26,7 +26,7 @@ import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles; |
| 26 | import org.onosproject.yangutils.utils.io.impl.YangPluginConfig; | 26 | import org.onosproject.yangutils.utils.io.impl.YangPluginConfig; |
| 27 | 27 | ||
| 28 | import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER; | 28 | import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER; |
| 29 | -import static org.onosproject.yangutils.translator.tojava.javamodel.YangJavaModelUtils.generateCodeAndUpdateInParent; | 29 | +import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.generateCodeAndUpdateInParent; |
| 30 | 30 | ||
| 31 | /** | 31 | /** |
| 32 | * Represents container information extended to support java code generation. | 32 | * Represents container information extended to support java code generation. | ... | ... |
| ... | @@ -27,7 +27,7 @@ import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles; | ... | @@ -27,7 +27,7 @@ import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles; |
| 27 | import org.onosproject.yangutils.utils.io.impl.YangPluginConfig; | 27 | import org.onosproject.yangutils.utils.io.impl.YangPluginConfig; |
| 28 | 28 | ||
| 29 | import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_ENUM_CLASS; | 29 | import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_ENUM_CLASS; |
| 30 | -import static org.onosproject.yangutils.translator.tojava.javamodel.YangJavaModelUtils.generateCodeOfNode; | 30 | +import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.generateCodeOfNode; |
| 31 | 31 | ||
| 32 | /** | 32 | /** |
| 33 | * Represents YANG java enumeration information extended to support java code generation. | 33 | * Represents YANG java enumeration information extended to support java code generation. | ... | ... |
| ... | @@ -31,7 +31,7 @@ import java.util.List; | ... | @@ -31,7 +31,7 @@ import java.util.List; |
| 31 | 31 | ||
| 32 | import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER; | 32 | import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER; |
| 33 | import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_IDENTITY_CLASS; | 33 | import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_IDENTITY_CLASS; |
| 34 | -import static org.onosproject.yangutils.translator.tojava.javamodel.YangJavaModelUtils.updatePackageInfo; | 34 | +import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.updatePackageInfo; |
| 35 | import static org.onosproject.yangutils.translator.tojava.utils.JavaFileGeneratorUtils.getFileObject; | 35 | import static org.onosproject.yangutils.translator.tojava.utils.JavaFileGeneratorUtils.getFileObject; |
| 36 | import static org.onosproject.yangutils.translator.tojava.utils.JavaFileGeneratorUtils.initiateJavaFileGeneration; | 36 | import static org.onosproject.yangutils.translator.tojava.utils.JavaFileGeneratorUtils.initiateJavaFileGeneration; |
| 37 | import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.createPackage; | 37 | import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.createPackage; | ... | ... |
| ... | @@ -27,7 +27,7 @@ import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles; | ... | @@ -27,7 +27,7 @@ import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles; |
| 27 | import org.onosproject.yangutils.utils.io.impl.YangPluginConfig; | 27 | import org.onosproject.yangutils.utils.io.impl.YangPluginConfig; |
| 28 | 28 | ||
| 29 | import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER; | 29 | import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER; |
| 30 | -import static org.onosproject.yangutils.translator.tojava.javamodel.YangJavaModelUtils.generateCodeOfAugmentableNode; | 30 | +import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.generateCodeOfAugmentableNode; |
| 31 | 31 | ||
| 32 | /** | 32 | /** |
| 33 | * Represents input information extended to support java code generation. | 33 | * Represents input information extended to support java code generation. | ... | ... |
| ... | @@ -26,7 +26,7 @@ import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles; | ... | @@ -26,7 +26,7 @@ import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles; |
| 26 | import org.onosproject.yangutils.utils.io.impl.YangPluginConfig; | 26 | import org.onosproject.yangutils.utils.io.impl.YangPluginConfig; |
| 27 | 27 | ||
| 28 | import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER; | 28 | import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER; |
| 29 | -import static org.onosproject.yangutils.translator.tojava.javamodel.YangJavaModelUtils.generateCodeAndUpdateInParent; | 29 | +import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.generateCodeAndUpdateInParent; |
| 30 | 30 | ||
| 31 | /** | 31 | /** |
| 32 | * Represents YANG list information extended to support java code generation. | 32 | * Represents YANG list information extended to support java code generation. | ... | ... |
| ... | @@ -32,10 +32,11 @@ import org.onosproject.yangutils.utils.io.impl.YangPluginConfig; | ... | @@ -32,10 +32,11 @@ import org.onosproject.yangutils.utils.io.impl.YangPluginConfig; |
| 32 | import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_EVENT_CLASS; | 32 | import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_EVENT_CLASS; |
| 33 | import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_EVENT_LISTENER_INTERFACE; | 33 | import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_EVENT_LISTENER_INTERFACE; |
| 34 | import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_EVENT_SUBJECT_CLASS; | 34 | import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_EVENT_SUBJECT_CLASS; |
| 35 | +import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER; | ||
| 35 | import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_SERVICE_AND_MANAGER; | 36 | import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_SERVICE_AND_MANAGER; |
| 36 | -import static org.onosproject.yangutils.translator.tojava.javamodel.YangJavaModelUtils.generateCodeOfRootNode; | 37 | +import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.generateCodeOfRootNode; |
| 37 | -import static org.onosproject.yangutils.translator.tojava.javamodel.YangJavaModelUtils.isManagerCodeGenRequired; | 38 | +import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.isManagerCodeGenRequired; |
| 38 | -import static org.onosproject.yangutils.translator.tojava.javamodel.YangJavaModelUtils.isGenerationOfCodeReq; | 39 | +import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.isGenerationOfCodeReq; |
| 39 | import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.getRootPackage; | 40 | import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.getRootPackage; |
| 40 | import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.searchAndDeleteTempDir; | 41 | import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.searchAndDeleteTempDir; |
| 41 | 42 | ||
| ... | @@ -71,7 +72,7 @@ public class YangJavaModule | ... | @@ -71,7 +72,7 @@ public class YangJavaModule |
| 71 | super(); | 72 | super(); |
| 72 | setJavaFileInfo(new JavaFileInfo()); | 73 | setJavaFileInfo(new JavaFileInfo()); |
| 73 | setNotificationNodes(new ArrayList<>()); | 74 | setNotificationNodes(new ArrayList<>()); |
| 74 | - int gentype = GENERATE_SERVICE_AND_MANAGER; | 75 | + int gentype = GENERATE_SERVICE_AND_MANAGER | GENERATE_INTERFACE_WITH_BUILDER; |
| 75 | if (isNotificationChildNodePresent(this)) { | 76 | if (isNotificationChildNodePresent(this)) { |
| 76 | gentype = GENERATE_SERVICE_AND_MANAGER | GENERATE_EVENT_SUBJECT_CLASS | GENERATE_EVENT_CLASS | 77 | gentype = GENERATE_SERVICE_AND_MANAGER | GENERATE_EVENT_SUBJECT_CLASS | GENERATE_EVENT_CLASS |
| 77 | | GENERATE_EVENT_LISTENER_INTERFACE; | 78 | | GENERATE_EVENT_LISTENER_INTERFACE; |
| ... | @@ -158,7 +159,10 @@ public class YangJavaModule | ... | @@ -158,7 +159,10 @@ public class YangJavaModule |
| 158 | 159 | ||
| 159 | try { | 160 | try { |
| 160 | if (isManagerCodeGenRequired(this) && isGenerationOfCodeReq(getJavaFileInfo())) { | 161 | if (isManagerCodeGenRequired(this) && isGenerationOfCodeReq(getJavaFileInfo())) { |
| 161 | - getTempJavaCodeFragmentFiles().generateJavaFile(GENERATE_SERVICE_AND_MANAGER, this); | 162 | + getTempJavaCodeFragmentFiles() |
| 163 | + .generateJavaFile(GENERATE_INTERFACE_WITH_BUILDER, this); | ||
| 164 | + getTempJavaCodeFragmentFiles() | ||
| 165 | + .generateJavaFile(GENERATE_SERVICE_AND_MANAGER, this); | ||
| 162 | } | 166 | } |
| 163 | searchAndDeleteTempDir(getJavaFileInfo().getBaseCodeGenPath() + | 167 | searchAndDeleteTempDir(getJavaFileInfo().getBaseCodeGenPath() + |
| 164 | getJavaFileInfo().getPackageFilePath()); | 168 | getJavaFileInfo().getPackageFilePath()); | ... | ... |
| ... | @@ -28,12 +28,13 @@ import org.onosproject.yangutils.translator.tojava.JavaFileInfoContainer; | ... | @@ -28,12 +28,13 @@ import org.onosproject.yangutils.translator.tojava.JavaFileInfoContainer; |
| 28 | import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfo; | 28 | import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfo; |
| 29 | import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles; | 29 | import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles; |
| 30 | import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFilesContainer; | 30 | import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFilesContainer; |
| 31 | +import org.onosproject.yangutils.translator.tojava.TempJavaServiceFragmentFiles; | ||
| 31 | import org.onosproject.yangutils.translator.tojava.utils.JavaExtendsListHolder; | 32 | import org.onosproject.yangutils.translator.tojava.utils.JavaExtendsListHolder; |
| 32 | import org.onosproject.yangutils.utils.io.impl.YangPluginConfig; | 33 | import org.onosproject.yangutils.utils.io.impl.YangPluginConfig; |
| 33 | 34 | ||
| 34 | import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER; | 35 | import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER; |
| 35 | import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCapitalCase; | 36 | import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCapitalCase; |
| 36 | -import static org.onosproject.yangutils.translator.tojava.javamodel.YangJavaModelUtils.generateCodeOfAugmentableNode; | 37 | +import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.generateCodeOfAugmentableNode; |
| 37 | import static org.onosproject.yangutils.utils.UtilConstants.EVENT_LISTENER_STRING; | 38 | import static org.onosproject.yangutils.utils.UtilConstants.EVENT_LISTENER_STRING; |
| 38 | import static org.onosproject.yangutils.utils.UtilConstants.EVENT_STRING; | 39 | import static org.onosproject.yangutils.utils.UtilConstants.EVENT_STRING; |
| 39 | 40 | ||
| ... | @@ -143,22 +144,23 @@ public class YangJavaNotification | ... | @@ -143,22 +144,23 @@ public class YangJavaNotification |
| 143 | /*Adds current notification info to the extends list so its parents service*/ | 144 | /*Adds current notification info to the extends list so its parents service*/ |
| 144 | private void addNotificationToExtendsList() { | 145 | private void addNotificationToExtendsList() { |
| 145 | YangNode parent = getParent(); | 146 | YangNode parent = getParent(); |
| 146 | - JavaExtendsListHolder holder = ((TempJavaCodeFragmentFilesContainer) parent) | 147 | + TempJavaServiceFragmentFiles tempJavaServiceFragmentFiles = ((TempJavaCodeFragmentFilesContainer) parent) |
| 147 | .getTempJavaCodeFragmentFiles() | 148 | .getTempJavaCodeFragmentFiles() |
| 148 | - .getServiceTempFiles().getJavaExtendsListHolder(); | 149 | + .getServiceTempFiles(); |
| 150 | + JavaExtendsListHolder holder = tempJavaServiceFragmentFiles.getJavaExtendsListHolder(); | ||
| 149 | JavaQualifiedTypeInfo event = new JavaQualifiedTypeInfo(); | 151 | JavaQualifiedTypeInfo event = new JavaQualifiedTypeInfo(); |
| 150 | 152 | ||
| 151 | String parentInfo = getCapitalCase(((JavaFileInfoContainer) parent) | 153 | String parentInfo = getCapitalCase(((JavaFileInfoContainer) parent) |
| 152 | .getJavaFileInfo().getJavaName()); | 154 | .getJavaFileInfo().getJavaName()); |
| 153 | event.setClassInfo(parentInfo + EVENT_STRING); | 155 | event.setClassInfo(parentInfo + EVENT_STRING); |
| 154 | event.setPkgInfo(getJavaFileInfo().getPackage()); | 156 | event.setPkgInfo(getJavaFileInfo().getPackage()); |
| 155 | - holder.addToExtendsList(event, parent); | 157 | + holder.addToExtendsList(event, parent, tempJavaServiceFragmentFiles); |
| 156 | 158 | ||
| 157 | JavaQualifiedTypeInfo eventListener = new JavaQualifiedTypeInfo(); | 159 | JavaQualifiedTypeInfo eventListener = new JavaQualifiedTypeInfo(); |
| 158 | 160 | ||
| 159 | eventListener.setClassInfo(parentInfo + EVENT_LISTENER_STRING); | 161 | eventListener.setClassInfo(parentInfo + EVENT_LISTENER_STRING); |
| 160 | eventListener.setPkgInfo(getJavaFileInfo().getPackage()); | 162 | eventListener.setPkgInfo(getJavaFileInfo().getPackage()); |
| 161 | - holder.addToExtendsList(eventListener, parent); | 163 | + holder.addToExtendsList(eventListener, parent, tempJavaServiceFragmentFiles); |
| 162 | 164 | ||
| 163 | } | 165 | } |
| 164 | 166 | ... | ... |
| ... | @@ -27,7 +27,7 @@ import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles; | ... | @@ -27,7 +27,7 @@ import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles; |
| 27 | import org.onosproject.yangutils.utils.io.impl.YangPluginConfig; | 27 | import org.onosproject.yangutils.utils.io.impl.YangPluginConfig; |
| 28 | 28 | ||
| 29 | import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER; | 29 | import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER; |
| 30 | -import static org.onosproject.yangutils.translator.tojava.javamodel.YangJavaModelUtils.generateCodeOfAugmentableNode; | 30 | +import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.generateCodeOfAugmentableNode; |
| 31 | 31 | ||
| 32 | /** | 32 | /** |
| 33 | * Represents output information extended to support java code generation. | 33 | * Represents output information extended to support java code generation. | ... | ... |
| ... | @@ -39,7 +39,7 @@ import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.getParent | ... | @@ -39,7 +39,7 @@ import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.getParent |
| 39 | import static org.onosproject.yangutils.translator.tojava.JavaAttributeInfo.getAttributeInfoForTheData; | 39 | import static org.onosproject.yangutils.translator.tojava.JavaAttributeInfo.getAttributeInfoForTheData; |
| 40 | import static org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfo.getQualifiedTypeInfoOfCurNode; | 40 | import static org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfo.getQualifiedTypeInfoOfCurNode; |
| 41 | import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCapitalCase; | 41 | import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCapitalCase; |
| 42 | -import static org.onosproject.yangutils.translator.tojava.javamodel.YangJavaModelUtils.updatePackageInfo; | 42 | +import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.updatePackageInfo; |
| 43 | import static org.onosproject.yangutils.utils.UtilConstants.ACTIVATE; | 43 | import static org.onosproject.yangutils.utils.UtilConstants.ACTIVATE; |
| 44 | import static org.onosproject.yangutils.utils.UtilConstants.COMPONENT; | 44 | import static org.onosproject.yangutils.utils.UtilConstants.COMPONENT; |
| 45 | import static org.onosproject.yangutils.utils.UtilConstants.DEACTIVATE; | 45 | import static org.onosproject.yangutils.utils.UtilConstants.DEACTIVATE; | ... | ... |
| ... | @@ -34,10 +34,11 @@ import org.onosproject.yangutils.utils.io.impl.YangPluginConfig; | ... | @@ -34,10 +34,11 @@ import org.onosproject.yangutils.utils.io.impl.YangPluginConfig; |
| 34 | import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_EVENT_CLASS; | 34 | import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_EVENT_CLASS; |
| 35 | import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_EVENT_LISTENER_INTERFACE; | 35 | import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_EVENT_LISTENER_INTERFACE; |
| 36 | import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_EVENT_SUBJECT_CLASS; | 36 | import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_EVENT_SUBJECT_CLASS; |
| 37 | +import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER; | ||
| 37 | import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_SERVICE_AND_MANAGER; | 38 | import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_SERVICE_AND_MANAGER; |
| 38 | -import static org.onosproject.yangutils.translator.tojava.javamodel.YangJavaModelUtils.generateCodeOfRootNode; | 39 | +import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.generateCodeOfRootNode; |
| 39 | -import static org.onosproject.yangutils.translator.tojava.javamodel.YangJavaModelUtils.isManagerCodeGenRequired; | 40 | +import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.isManagerCodeGenRequired; |
| 40 | -import static org.onosproject.yangutils.translator.tojava.javamodel.YangJavaModelUtils.isGenerationOfCodeReq; | 41 | +import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.isGenerationOfCodeReq; |
| 41 | import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.getRootPackage; | 42 | import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.getRootPackage; |
| 42 | import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.searchAndDeleteTempDir; | 43 | import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.searchAndDeleteTempDir; |
| 43 | 44 | ||
| ... | @@ -72,7 +73,7 @@ public class YangJavaSubModule | ... | @@ -72,7 +73,7 @@ public class YangJavaSubModule |
| 72 | public YangJavaSubModule() { | 73 | public YangJavaSubModule() { |
| 73 | super(); | 74 | super(); |
| 74 | setJavaFileInfo(new JavaFileInfo()); | 75 | setJavaFileInfo(new JavaFileInfo()); |
| 75 | - int gentype = GENERATE_SERVICE_AND_MANAGER; | 76 | + int gentype = GENERATE_SERVICE_AND_MANAGER | GENERATE_INTERFACE_WITH_BUILDER; |
| 76 | if (isNotificationChildNodePresent(this)) { | 77 | if (isNotificationChildNodePresent(this)) { |
| 77 | gentype = GENERATE_SERVICE_AND_MANAGER | GENERATE_EVENT_SUBJECT_CLASS | GENERATE_EVENT_CLASS | 78 | gentype = GENERATE_SERVICE_AND_MANAGER | GENERATE_EVENT_SUBJECT_CLASS | GENERATE_EVENT_CLASS |
| 78 | | GENERATE_EVENT_LISTENER_INTERFACE; | 79 | | GENERATE_EVENT_LISTENER_INTERFACE; |
| ... | @@ -170,6 +171,8 @@ public class YangJavaSubModule | ... | @@ -170,6 +171,8 @@ public class YangJavaSubModule |
| 170 | */ | 171 | */ |
| 171 | try { | 172 | try { |
| 172 | if (isManagerCodeGenRequired(this) && isGenerationOfCodeReq(getJavaFileInfo())) { | 173 | if (isManagerCodeGenRequired(this) && isGenerationOfCodeReq(getJavaFileInfo())) { |
| 174 | + | ||
| 175 | + getTempJavaCodeFragmentFiles().generateJavaFile(GENERATE_INTERFACE_WITH_BUILDER, this); | ||
| 173 | getTempJavaCodeFragmentFiles().generateJavaFile(GENERATE_SERVICE_AND_MANAGER, this); | 176 | getTempJavaCodeFragmentFiles().generateJavaFile(GENERATE_SERVICE_AND_MANAGER, this); |
| 174 | } | 177 | } |
| 175 | searchAndDeleteTempDir(getJavaFileInfo().getBaseCodeGenPath() + | 178 | searchAndDeleteTempDir(getJavaFileInfo().getBaseCodeGenPath() + | ... | ... |
| ... | @@ -26,7 +26,7 @@ import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles; | ... | @@ -26,7 +26,7 @@ import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles; |
| 26 | import org.onosproject.yangutils.utils.io.impl.YangPluginConfig; | 26 | import org.onosproject.yangutils.utils.io.impl.YangPluginConfig; |
| 27 | 27 | ||
| 28 | import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_TYPEDEF_CLASS; | 28 | import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_TYPEDEF_CLASS; |
| 29 | -import static org.onosproject.yangutils.translator.tojava.javamodel.YangJavaModelUtils.generateCodeOfNode; | 29 | +import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.generateCodeOfNode; |
| 30 | 30 | ||
| 31 | /** | 31 | /** |
| 32 | * Represents type define information extended to support java code generation. | 32 | * Represents type define information extended to support java code generation. | ... | ... |
| ... | @@ -26,7 +26,7 @@ import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles; | ... | @@ -26,7 +26,7 @@ import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles; |
| 26 | import org.onosproject.yangutils.utils.io.impl.YangPluginConfig; | 26 | import org.onosproject.yangutils.utils.io.impl.YangPluginConfig; |
| 27 | 27 | ||
| 28 | import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_UNION_CLASS; | 28 | import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_UNION_CLASS; |
| 29 | -import static org.onosproject.yangutils.translator.tojava.javamodel.YangJavaModelUtils.generateCodeOfNode; | 29 | +import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.generateCodeOfNode; |
| 30 | 30 | ||
| 31 | /** | 31 | /** |
| 32 | * Represents union information extended to support java code generation. | 32 | * Represents union information extended to support java code generation. | ... | ... |
| ... | @@ -282,7 +282,7 @@ public final class ClassDefinitionGenerator { | ... | @@ -282,7 +282,7 @@ public final class ClassDefinitionGenerator { |
| 282 | curNode = curNode.getChild(); | 282 | curNode = curNode.getChild(); |
| 283 | while (curNode != null) { | 283 | while (curNode != null) { |
| 284 | if (curNode instanceof YangNotification) { | 284 | if (curNode instanceof YangNotification) { |
| 285 | - return getRpcInterfaceDefinitionWhenItExtends(yangName, holder); | 285 | + return getRpcInterfaceDefinitionWhenItExtends(yangName); |
| 286 | } | 286 | } |
| 287 | curNode = curNode.getNextSibling(); | 287 | curNode = curNode.getNextSibling(); |
| 288 | } | 288 | } |
| ... | @@ -295,8 +295,7 @@ public final class ClassDefinitionGenerator { | ... | @@ -295,8 +295,7 @@ public final class ClassDefinitionGenerator { |
| 295 | } | 295 | } |
| 296 | 296 | ||
| 297 | /* Provides class definition when RPC interface needs to extends any event.*/ | 297 | /* Provides class definition when RPC interface needs to extends any event.*/ |
| 298 | - private static String getRpcInterfaceDefinitionWhenItExtends(String yangName, | 298 | + private static String getRpcInterfaceDefinitionWhenItExtends(String yangName) { |
| 299 | - JavaExtendsListHolder holder) { | ||
| 300 | 299 | ||
| 301 | if (yangName.matches(REGEX_FOR_ANY_STRING_ENDING_WITH_SERVICE)) { | 300 | if (yangName.matches(REGEX_FOR_ANY_STRING_ENDING_WITH_SERVICE)) { |
| 302 | String[] strArray = yangName.split(SERVICE); | 301 | String[] strArray = yangName.split(SERVICE); | ... | ... |
| ... | @@ -19,14 +19,14 @@ package org.onosproject.yangutils.translator.tojava.utils; | ... | @@ -19,14 +19,14 @@ package org.onosproject.yangutils.translator.tojava.utils; |
| 19 | import java.util.List; | 19 | import java.util.List; |
| 20 | 20 | ||
| 21 | import org.onosproject.yangutils.datamodel.YangNode; | 21 | import org.onosproject.yangutils.datamodel.YangNode; |
| 22 | +import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo; | ||
| 22 | import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfo; | 23 | import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfo; |
| 23 | -import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles; | 24 | +import org.onosproject.yangutils.translator.tojava.TempJavaServiceFragmentFiles; |
| 24 | -import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFilesContainer; | ||
| 25 | -import org.onosproject.yangutils.translator.tojava.TempJavaFragmentFiles; | ||
| 26 | import org.onosproject.yangutils.utils.io.impl.YangPluginConfig; | 25 | import org.onosproject.yangutils.utils.io.impl.YangPluginConfig; |
| 27 | 26 | ||
| 28 | import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.getEnumJavaAttribute; | 27 | import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.getEnumJavaAttribute; |
| 29 | import static org.onosproject.yangutils.utils.UtilConstants.ACTIVATE_ANNOTATION_IMPORT; | 28 | import static org.onosproject.yangutils.utils.UtilConstants.ACTIVATE_ANNOTATION_IMPORT; |
| 29 | +import static org.onosproject.yangutils.utils.UtilConstants.CLASS_STRING; | ||
| 30 | import static org.onosproject.yangutils.utils.UtilConstants.CLOSE_CURLY_BRACKET; | 30 | import static org.onosproject.yangutils.utils.UtilConstants.CLOSE_CURLY_BRACKET; |
| 31 | import static org.onosproject.yangutils.utils.UtilConstants.CLOSE_PARENTHESIS; | 31 | import static org.onosproject.yangutils.utils.UtilConstants.CLOSE_PARENTHESIS; |
| 32 | import static org.onosproject.yangutils.utils.UtilConstants.COMMA; | 32 | import static org.onosproject.yangutils.utils.UtilConstants.COMMA; |
| ... | @@ -38,6 +38,7 @@ import static org.onosproject.yangutils.utils.UtilConstants.DIAMOND_OPEN_BRACKET | ... | @@ -38,6 +38,7 @@ import static org.onosproject.yangutils.utils.UtilConstants.DIAMOND_OPEN_BRACKET |
| 38 | import static org.onosproject.yangutils.utils.UtilConstants.ENUM; | 38 | import static org.onosproject.yangutils.utils.UtilConstants.ENUM; |
| 39 | import static org.onosproject.yangutils.utils.UtilConstants.EQUAL; | 39 | import static org.onosproject.yangutils.utils.UtilConstants.EQUAL; |
| 40 | import static org.onosproject.yangutils.utils.UtilConstants.FOUR_SPACE_INDENTATION; | 40 | import static org.onosproject.yangutils.utils.UtilConstants.FOUR_SPACE_INDENTATION; |
| 41 | +import static org.onosproject.yangutils.utils.UtilConstants.HASH_MAP; | ||
| 41 | import static org.onosproject.yangutils.utils.UtilConstants.IMMEDIATE; | 42 | import static org.onosproject.yangutils.utils.UtilConstants.IMMEDIATE; |
| 42 | import static org.onosproject.yangutils.utils.UtilConstants.IMPORT; | 43 | import static org.onosproject.yangutils.utils.UtilConstants.IMPORT; |
| 43 | import static org.onosproject.yangutils.utils.UtilConstants.INT; | 44 | import static org.onosproject.yangutils.utils.UtilConstants.INT; |
| ... | @@ -45,18 +46,22 @@ import static org.onosproject.yangutils.utils.UtilConstants.LIST; | ... | @@ -45,18 +46,22 @@ import static org.onosproject.yangutils.utils.UtilConstants.LIST; |
| 45 | import static org.onosproject.yangutils.utils.UtilConstants.LISTENER_SERVICE; | 46 | import static org.onosproject.yangutils.utils.UtilConstants.LISTENER_SERVICE; |
| 46 | import static org.onosproject.yangutils.utils.UtilConstants.LOGGER_FACTORY_IMPORT; | 47 | import static org.onosproject.yangutils.utils.UtilConstants.LOGGER_FACTORY_IMPORT; |
| 47 | import static org.onosproject.yangutils.utils.UtilConstants.LOGGER_IMPORT; | 48 | import static org.onosproject.yangutils.utils.UtilConstants.LOGGER_IMPORT; |
| 49 | +import static org.onosproject.yangutils.utils.UtilConstants.MAP; | ||
| 50 | +import static org.onosproject.yangutils.utils.UtilConstants.NEW; | ||
| 48 | import static org.onosproject.yangutils.utils.UtilConstants.NEW_LINE; | 51 | import static org.onosproject.yangutils.utils.UtilConstants.NEW_LINE; |
| 49 | import static org.onosproject.yangutils.utils.UtilConstants.OPEN_CURLY_BRACKET; | 52 | import static org.onosproject.yangutils.utils.UtilConstants.OPEN_CURLY_BRACKET; |
| 50 | import static org.onosproject.yangutils.utils.UtilConstants.OPEN_PARENTHESIS; | 53 | import static org.onosproject.yangutils.utils.UtilConstants.OPEN_PARENTHESIS; |
| 51 | import static org.onosproject.yangutils.utils.UtilConstants.PERIOD; | 54 | import static org.onosproject.yangutils.utils.UtilConstants.PERIOD; |
| 52 | import static org.onosproject.yangutils.utils.UtilConstants.PRIVATE; | 55 | import static org.onosproject.yangutils.utils.UtilConstants.PRIVATE; |
| 53 | import static org.onosproject.yangutils.utils.UtilConstants.PUBLIC; | 56 | import static org.onosproject.yangutils.utils.UtilConstants.PUBLIC; |
| 57 | +import static org.onosproject.yangutils.utils.UtilConstants.QUESTION_MARK; | ||
| 54 | import static org.onosproject.yangutils.utils.UtilConstants.SEMI_COLAN; | 58 | import static org.onosproject.yangutils.utils.UtilConstants.SEMI_COLAN; |
| 55 | import static org.onosproject.yangutils.utils.UtilConstants.SERVICE_ANNOTATION; | 59 | import static org.onosproject.yangutils.utils.UtilConstants.SERVICE_ANNOTATION; |
| 56 | import static org.onosproject.yangutils.utils.UtilConstants.SERVICE_ANNOTATION_IMPORT; | 60 | import static org.onosproject.yangutils.utils.UtilConstants.SERVICE_ANNOTATION_IMPORT; |
| 57 | import static org.onosproject.yangutils.utils.UtilConstants.SPACE; | 61 | import static org.onosproject.yangutils.utils.UtilConstants.SPACE; |
| 58 | import static org.onosproject.yangutils.utils.UtilConstants.TRUE; | 62 | import static org.onosproject.yangutils.utils.UtilConstants.TRUE; |
| 59 | import static org.onosproject.yangutils.utils.UtilConstants.TYPE; | 63 | import static org.onosproject.yangutils.utils.UtilConstants.TYPE; |
| 64 | +import static org.onosproject.yangutils.utils.UtilConstants.YANG_AUGMENTED_INFO; | ||
| 60 | import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.ENUM_ATTRIBUTE; | 65 | import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.ENUM_ATTRIBUTE; |
| 61 | import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.getJavaDoc; | 66 | import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.getJavaDoc; |
| 62 | import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getSmallCase; | 67 | import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getSmallCase; |
| ... | @@ -221,11 +226,13 @@ public final class JavaCodeSnippetGen { | ... | @@ -221,11 +226,13 @@ public final class JavaCodeSnippetGen { |
| 221 | public static void addListenersImport(YangNode curNode, List<String> imports, boolean operation, | 226 | public static void addListenersImport(YangNode curNode, List<String> imports, boolean operation, |
| 222 | String classInfo) { | 227 | String classInfo) { |
| 223 | String thisImport = ""; | 228 | String thisImport = ""; |
| 229 | + TempJavaServiceFragmentFiles tempJavaServiceFragmentFiles = ((JavaCodeGeneratorInfo) curNode) | ||
| 230 | + .getTempJavaCodeFragmentFiles().getServiceTempFiles(); | ||
| 224 | if (classInfo.equals(LISTENER_SERVICE)) { | 231 | if (classInfo.equals(LISTENER_SERVICE)) { |
| 225 | - thisImport = getTempJavaFragment(curNode).getJavaImportData().getListenerServiceImport(); | 232 | + thisImport = tempJavaServiceFragmentFiles.getJavaImportData().getListenerServiceImport(); |
| 226 | performOperationOnImports(imports, thisImport, operation); | 233 | performOperationOnImports(imports, thisImport, operation); |
| 227 | } else { | 234 | } else { |
| 228 | - thisImport = getTempJavaFragment(curNode).getJavaImportData().getListenerRegistryImport(); | 235 | + thisImport = tempJavaServiceFragmentFiles.getJavaImportData().getListenerRegistryImport(); |
| 229 | performOperationOnImports(imports, thisImport, operation); | 236 | performOperationOnImports(imports, thisImport, operation); |
| 230 | } | 237 | } |
| 231 | } | 238 | } |
| ... | @@ -250,25 +257,6 @@ public final class JavaCodeSnippetGen { | ... | @@ -250,25 +257,6 @@ public final class JavaCodeSnippetGen { |
| 250 | } | 257 | } |
| 251 | 258 | ||
| 252 | /** | 259 | /** |
| 253 | - * Returns temp java fragment. | ||
| 254 | - * | ||
| 255 | - * @param curNode current YANG node | ||
| 256 | - * @return temp java fragments | ||
| 257 | - */ | ||
| 258 | - public static TempJavaFragmentFiles getTempJavaFragment(YangNode curNode) { | ||
| 259 | - TempJavaCodeFragmentFiles container = ((TempJavaCodeFragmentFilesContainer) curNode) | ||
| 260 | - .getTempJavaCodeFragmentFiles(); | ||
| 261 | - if (container.getBeanTempFiles() != null) { | ||
| 262 | - return container.getBeanTempFiles(); | ||
| 263 | - } | ||
| 264 | - if (container.getServiceTempFiles() != null) { | ||
| 265 | - return container.getServiceTempFiles(); | ||
| 266 | - } | ||
| 267 | - | ||
| 268 | - return null; | ||
| 269 | - } | ||
| 270 | - | ||
| 271 | - /** | ||
| 272 | * Returns integer attribute for enum's class to get the values. | 260 | * Returns integer attribute for enum's class to get the values. |
| 273 | * | 261 | * |
| 274 | * @param className enum's class name | 262 | * @param className enum's class name |
| ... | @@ -285,7 +273,20 @@ public final class JavaCodeSnippetGen { | ... | @@ -285,7 +273,20 @@ public final class JavaCodeSnippetGen { |
| 285 | * @return component string | 273 | * @return component string |
| 286 | */ | 274 | */ |
| 287 | public static String addComponentString() { | 275 | public static String addComponentString() { |
| 288 | - return NEW_LINE + COMPONENT_ANNOTATION + SPACE + OPEN_PARENTHESIS + IMMEDIATE + SPACE | 276 | + return NEW_LINE + COMPONENT_ANNOTATION + OPEN_PARENTHESIS + IMMEDIATE + SPACE |
| 289 | + EQUAL + SPACE + TRUE + CLOSE_PARENTHESIS + NEW_LINE + SERVICE_ANNOTATION; | 277 | + EQUAL + SPACE + TRUE + CLOSE_PARENTHESIS + NEW_LINE + SERVICE_ANNOTATION; |
| 290 | } | 278 | } |
| 279 | + | ||
| 280 | + /** | ||
| 281 | + * Returns attribute for augmentation. | ||
| 282 | + * | ||
| 283 | + * @return attribute for augmentation | ||
| 284 | + */ | ||
| 285 | + public static String addAugmentationAttribute() { | ||
| 286 | + return NEW_LINE + FOUR_SPACE_INDENTATION + PRIVATE + SPACE + MAP + DIAMOND_OPEN_BRACKET + CLASS_STRING | ||
| 287 | + + DIAMOND_OPEN_BRACKET + QUESTION_MARK + DIAMOND_CLOSE_BRACKET + COMMA + SPACE + YANG_AUGMENTED_INFO | ||
| 288 | + + DIAMOND_CLOSE_BRACKET + SPACE + getSmallCase(YANG_AUGMENTED_INFO) + MAP + SPACE + EQUAL + SPACE + | ||
| 289 | + NEW + SPACE + HASH_MAP + DIAMOND_OPEN_BRACKET + DIAMOND_CLOSE_BRACKET + OPEN_PARENTHESIS | ||
| 290 | + + CLOSE_PARENTHESIS + SEMI_COLAN; | ||
| 291 | + } | ||
| 291 | } | 292 | } | ... | ... |
| ... | @@ -26,9 +26,9 @@ import org.onosproject.yangutils.translator.tojava.JavaFileInfo; | ... | @@ -26,9 +26,9 @@ import org.onosproject.yangutils.translator.tojava.JavaFileInfo; |
| 26 | import org.onosproject.yangutils.translator.tojava.JavaFileInfoContainer; | 26 | import org.onosproject.yangutils.translator.tojava.JavaFileInfoContainer; |
| 27 | import org.onosproject.yangutils.translator.tojava.JavaImportData; | 27 | import org.onosproject.yangutils.translator.tojava.JavaImportData; |
| 28 | import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfo; | 28 | import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfo; |
| 29 | +import org.onosproject.yangutils.translator.tojava.TempJavaFragmentFiles; | ||
| 29 | 30 | ||
| 30 | import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCapitalCase; | 31 | import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCapitalCase; |
| 31 | -import static org.onosproject.yangutils.translator.tojava.utils.JavaCodeSnippetGen.getTempJavaFragment; | ||
| 32 | 32 | ||
| 33 | /** | 33 | /** |
| 34 | * Represent the extends list for generated java classes. It holds the class details which needs | 34 | * Represent the extends list for generated java classes. It holds the class details which needs |
| ... | @@ -36,6 +36,9 @@ import static org.onosproject.yangutils.translator.tojava.utils.JavaCodeSnippetG | ... | @@ -36,6 +36,9 @@ import static org.onosproject.yangutils.translator.tojava.utils.JavaCodeSnippetG |
| 36 | */ | 36 | */ |
| 37 | public class JavaExtendsListHolder { | 37 | public class JavaExtendsListHolder { |
| 38 | 38 | ||
| 39 | + private Map<JavaQualifiedTypeInfo, Boolean> extendedClassStore; | ||
| 40 | + private List<JavaQualifiedTypeInfo> extendsList; | ||
| 41 | + | ||
| 39 | /** | 42 | /** |
| 40 | * Creates an instance of JavaExtendsListHolder. | 43 | * Creates an instance of JavaExtendsListHolder. |
| 41 | */ | 44 | */ |
| ... | @@ -44,9 +47,6 @@ public class JavaExtendsListHolder { | ... | @@ -44,9 +47,6 @@ public class JavaExtendsListHolder { |
| 44 | setExtendsList(new ArrayList<>()); | 47 | setExtendsList(new ArrayList<>()); |
| 45 | } | 48 | } |
| 46 | 49 | ||
| 47 | - private Map<JavaQualifiedTypeInfo, Boolean> extendedClassStore; | ||
| 48 | - private List<JavaQualifiedTypeInfo> extendsList; | ||
| 49 | - | ||
| 50 | /** | 50 | /** |
| 51 | * Returns extends list. | 51 | * Returns extends list. |
| 52 | * | 52 | * |
| ... | @@ -68,13 +68,15 @@ public class JavaExtendsListHolder { | ... | @@ -68,13 +68,15 @@ public class JavaExtendsListHolder { |
| 68 | /** | 68 | /** |
| 69 | * Adds to the extends list. | 69 | * Adds to the extends list. |
| 70 | * | 70 | * |
| 71 | - * @param info java file info | 71 | + * @param info java file info |
| 72 | - * @param node YANG node | 72 | + * @param node YANG node |
| 73 | + * @param tempJavaFragmentFiles temp java fragment files | ||
| 73 | */ | 74 | */ |
| 74 | - public void addToExtendsList(JavaQualifiedTypeInfo info, YangNode node) { | 75 | + public void addToExtendsList(JavaQualifiedTypeInfo info, YangNode node, |
| 76 | + TempJavaFragmentFiles tempJavaFragmentFiles) { | ||
| 75 | JavaFileInfo fileInfo = ((JavaFileInfoContainer) node).getJavaFileInfo(); | 77 | JavaFileInfo fileInfo = ((JavaFileInfoContainer) node).getJavaFileInfo(); |
| 76 | 78 | ||
| 77 | - JavaImportData importData = getTempJavaFragment(node).getJavaImportData(); | 79 | + JavaImportData importData = tempJavaFragmentFiles.getJavaImportData(); |
| 78 | boolean qualified = importData.addImportInfo(info, | 80 | boolean qualified = importData.addImportInfo(info, |
| 79 | getCapitalCase(fileInfo.getJavaName()), fileInfo.getPackage()); | 81 | getCapitalCase(fileInfo.getJavaName()), fileInfo.getPackage()); |
| 80 | 82 | ... | ... |
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
| ... | @@ -97,11 +97,6 @@ public final class UtilConstants { | ... | @@ -97,11 +97,6 @@ public final class UtilConstants { |
| 97 | public static final String JAVA_DOC_RETURN = " * @return "; | 97 | public static final String JAVA_DOC_RETURN = " * @return "; |
| 98 | 98 | ||
| 99 | /** | 99 | /** |
| 100 | - * JavaDocs's throw annotation. | ||
| 101 | - */ | ||
| 102 | - public static final String JAVA_DOC_THROWS = " * @throws "; | ||
| 103 | - | ||
| 104 | - /** | ||
| 105 | * JavaDocs's description for setter method. | 100 | * JavaDocs's description for setter method. |
| 106 | */ | 101 | */ |
| 107 | public static final String JAVA_DOC_SETTERS = " * Returns the builder object of "; | 102 | public static final String JAVA_DOC_SETTERS = " * Returns the builder object of "; |
| ... | @@ -307,11 +302,6 @@ public final class UtilConstants { | ... | @@ -307,11 +302,6 @@ public final class UtilConstants { |
| 307 | public static final String IDENTITYREF = "identityref"; | 302 | public static final String IDENTITYREF = "identityref"; |
| 308 | 303 | ||
| 309 | /** | 304 | /** |
| 310 | - * Static attribute for instance identifier string. | ||
| 311 | - */ | ||
| 312 | - public static final String INSTANCE_IDENTIFIER = "instance-identifier"; | ||
| 313 | - | ||
| 314 | - /** | ||
| 315 | * Static attribute for output variable of rpc. | 305 | * Static attribute for output variable of rpc. |
| 316 | */ | 306 | */ |
| 317 | public static final String RPC_INPUT_VAR_NAME = "inputVar"; | 307 | public static final String RPC_INPUT_VAR_NAME = "inputVar"; |
| ... | @@ -332,16 +322,6 @@ public final class UtilConstants { | ... | @@ -332,16 +322,6 @@ public final class UtilConstants { |
| 332 | public static final String ADD = "+"; | 322 | public static final String ADD = "+"; |
| 333 | 323 | ||
| 334 | /** | 324 | /** |
| 335 | - * Static attribute for asterisk. | ||
| 336 | - */ | ||
| 337 | - public static final String ASTERISK = "*"; | ||
| 338 | - | ||
| 339 | - /** | ||
| 340 | - * Static attribute for at. | ||
| 341 | - */ | ||
| 342 | - public static final String AT = "@"; | ||
| 343 | - | ||
| 344 | - /** | ||
| 345 | * Static attribute for quotes. | 325 | * Static attribute for quotes. |
| 346 | */ | 326 | */ |
| 347 | public static final String QUOTES = "\""; | 327 | public static final String QUOTES = "\""; |
| ... | @@ -357,6 +337,21 @@ public final class UtilConstants { | ... | @@ -357,6 +337,21 @@ public final class UtilConstants { |
| 357 | public static final String COMMA = ","; | 337 | public static final String COMMA = ","; |
| 358 | 338 | ||
| 359 | /** | 339 | /** |
| 340 | + * Static attribute for class. | ||
| 341 | + */ | ||
| 342 | + public static final String CLASS_STRING = "Class"; | ||
| 343 | + | ||
| 344 | + /** | ||
| 345 | + * Static attribute for put. | ||
| 346 | + */ | ||
| 347 | + public static final String PUT = "put"; | ||
| 348 | + | ||
| 349 | + /** | ||
| 350 | + * Static attribute for get. | ||
| 351 | + */ | ||
| 352 | + public static final String GET = "get"; | ||
| 353 | + | ||
| 354 | + /** | ||
| 360 | * Static attribute for slash character. | 355 | * Static attribute for slash character. |
| 361 | */ | 356 | */ |
| 362 | public static final char CHAR_OF_SLASH = '/'; | 357 | public static final char CHAR_OF_SLASH = '/'; |
| ... | @@ -432,11 +427,6 @@ public final class UtilConstants { | ... | @@ -432,11 +427,6 @@ public final class UtilConstants { |
| 432 | public static final String VALUE = "value"; | 427 | public static final String VALUE = "value"; |
| 433 | 428 | ||
| 434 | /** | 429 | /** |
| 435 | - * Static attribute for enumValue syntax. | ||
| 436 | - */ | ||
| 437 | - public static final String ENUM_VALUE = "enumValue"; | ||
| 438 | - | ||
| 439 | - /** | ||
| 440 | * Static attribute for suffix s. | 430 | * Static attribute for suffix s. |
| 441 | */ | 431 | */ |
| 442 | public static final String SUFFIX_S = "s"; | 432 | public static final String SUFFIX_S = "s"; |
| ... | @@ -447,16 +437,6 @@ public final class UtilConstants { | ... | @@ -447,16 +437,6 @@ public final class UtilConstants { |
| 447 | public static final String IF = "if"; | 437 | public static final String IF = "if"; |
| 448 | 438 | ||
| 449 | /** | 439 | /** |
| 450 | - * Static attribute for for. | ||
| 451 | - */ | ||
| 452 | - public static final String FOR = "for"; | ||
| 453 | - | ||
| 454 | - /** | ||
| 455 | - * Static attribute for while. | ||
| 456 | - */ | ||
| 457 | - public static final String WHILE = "while"; | ||
| 458 | - | ||
| 459 | - /** | ||
| 460 | * Static attribute for of. | 440 | * Static attribute for of. |
| 461 | */ | 441 | */ |
| 462 | public static final String OF = "of"; | 442 | public static final String OF = "of"; |
| ... | @@ -532,11 +512,6 @@ public final class UtilConstants { | ... | @@ -532,11 +512,6 @@ public final class UtilConstants { |
| 532 | public static final String OPEN_PARENTHESIS = "("; | 512 | public static final String OPEN_PARENTHESIS = "("; |
| 533 | 513 | ||
| 534 | /** | 514 | /** |
| 535 | - * Static attribute for clear syntax. | ||
| 536 | - */ | ||
| 537 | - public static final String CLEAR = "clear"; | ||
| 538 | - | ||
| 539 | - /** | ||
| 540 | * Static attribute for switch syntax. | 515 | * Static attribute for switch syntax. |
| 541 | */ | 516 | */ |
| 542 | public static final String SWITCH = "switch"; | 517 | public static final String SWITCH = "switch"; |
| ... | @@ -592,11 +567,6 @@ public final class UtilConstants { | ... | @@ -592,11 +567,6 @@ public final class UtilConstants { |
| 592 | public static final String FOUR_SPACE_INDENTATION = " "; | 567 | public static final String FOUR_SPACE_INDENTATION = " "; |
| 593 | 568 | ||
| 594 | /** | 569 | /** |
| 595 | - * Static attribute for not syntax. | ||
| 596 | - */ | ||
| 597 | - public static final String NOT = "!"; | ||
| 598 | - | ||
| 599 | - /** | ||
| 600 | * Static attribute for try syntax. | 570 | * Static attribute for try syntax. |
| 601 | */ | 571 | */ |
| 602 | public static final String TRY = "try"; | 572 | public static final String TRY = "try"; |
| ... | @@ -667,11 +637,6 @@ public final class UtilConstants { | ... | @@ -667,11 +637,6 @@ public final class UtilConstants { |
| 667 | public static final String ABSTRACT = "abstract"; | 637 | public static final String ABSTRACT = "abstract"; |
| 668 | 638 | ||
| 669 | /** | 639 | /** |
| 670 | - * Static attribute for protected modifier. | ||
| 671 | - */ | ||
| 672 | - public static final String PROTECTED = "protected"; | ||
| 673 | - | ||
| 674 | - /** | ||
| 675 | * Void java type. | 640 | * Void java type. |
| 676 | */ | 641 | */ |
| 677 | public static final String VOID = "void"; | 642 | public static final String VOID = "void"; |
| ... | @@ -732,11 +697,6 @@ public final class UtilConstants { | ... | @@ -732,11 +697,6 @@ public final class UtilConstants { |
| 732 | public static final String LONG = "long"; | 697 | public static final String LONG = "long"; |
| 733 | 698 | ||
| 734 | /** | 699 | /** |
| 735 | - * Float java built in type. | ||
| 736 | - */ | ||
| 737 | - public static final String FLOAT = "float"; | ||
| 738 | - | ||
| 739 | - /** | ||
| 740 | * Double java built in type. | 700 | * Double java built in type. |
| 741 | */ | 701 | */ |
| 742 | public static final String DOUBLE = "double"; | 702 | public static final String DOUBLE = "double"; |
| ... | @@ -767,14 +727,9 @@ public final class UtilConstants { | ... | @@ -767,14 +727,9 @@ public final class UtilConstants { |
| 767 | public static final String LONG_WRAPPER = "Long"; | 727 | public static final String LONG_WRAPPER = "Long"; |
| 768 | 728 | ||
| 769 | /** | 729 | /** |
| 770 | - * YangUint64 java built in wrapper type. | 730 | + * Static varibale for question mark. |
| 771 | - */ | ||
| 772 | - public static final String YANG_UINT64 = "YangUint64"; | ||
| 773 | - | ||
| 774 | - /** | ||
| 775 | - * Double java built in wrapper type. | ||
| 776 | */ | 731 | */ |
| 777 | - public static final String DOUBLE_WRAPPER = "Double"; | 732 | + public static final String QUESTION_MARK = "?"; |
| 778 | 733 | ||
| 779 | /** | 734 | /** |
| 780 | * List of keywords in java, this is used for checking if the input does not contain these keywords. | 735 | * List of keywords in java, this is used for checking if the input does not contain these keywords. |
| ... | @@ -977,11 +932,22 @@ public final class UtilConstants { | ... | @@ -977,11 +932,22 @@ public final class UtilConstants { |
| 977 | public static final String OVERRIDE = "@Override"; | 932 | public static final String OVERRIDE = "@Override"; |
| 978 | 933 | ||
| 979 | /** | 934 | /** |
| 980 | - * Static attribute for new line. | 935 | + * Static attribute for collections. |
| 981 | */ | 936 | */ |
| 982 | public static final String COLLECTION_IMPORTS = "java.util"; | 937 | public static final String COLLECTION_IMPORTS = "java.util"; |
| 983 | 938 | ||
| 984 | /** | 939 | /** |
| 940 | + * Static attribute for map. | ||
| 941 | + */ | ||
| 942 | + public static final String MAP = "Map"; | ||
| 943 | + | ||
| 944 | + /** | ||
| 945 | + * Static attribute for hash map. | ||
| 946 | + */ | ||
| 947 | + public static final String HASH_MAP = "HashMap"; | ||
| 948 | + | ||
| 949 | + | ||
| 950 | + /** | ||
| 985 | * Static attribute for more object import package. | 951 | * Static attribute for more object import package. |
| 986 | */ | 952 | */ |
| 987 | public static final String GOOGLE_MORE_OBJECT_IMPORT_PKG = "com.google.common.base"; | 953 | public static final String GOOGLE_MORE_OBJECT_IMPORT_PKG = "com.google.common.base"; |
| ... | @@ -1007,25 +973,14 @@ public final class UtilConstants { | ... | @@ -1007,25 +973,14 @@ public final class UtilConstants { |
| 1007 | public static final String JAVA_UTIL_OBJECTS_IMPORT_CLASS = "Objects;\n"; | 973 | public static final String JAVA_UTIL_OBJECTS_IMPORT_CLASS = "Objects;\n"; |
| 1008 | 974 | ||
| 1009 | /** | 975 | /** |
| 1010 | - * Static attribute for AugmentationHolder class import package. | ||
| 1011 | - */ | ||
| 1012 | - public static final String PROVIDED_AUGMENTATION_CLASS_IMPORT_PKG = | ||
| 1013 | - "org.onosproject.yangutils.utils"; | ||
| 1014 | - | ||
| 1015 | - /** | ||
| 1016 | - * Static attribute for AugmentationHolder class import class. | ||
| 1017 | - */ | ||
| 1018 | - public static final String AUGMENTATION_HOLDER_CLASS_IMPORT_CLASS = "AugmentationHolder;\n"; | ||
| 1019 | - | ||
| 1020 | - /** | ||
| 1021 | * Static attribute for AugmentedInfo class import package. | 976 | * Static attribute for AugmentedInfo class import package. |
| 1022 | */ | 977 | */ |
| 1023 | - public static final String AUGMENTED_INFO_CLASS_IMPORT_PKG = "org.onosproject.yangutils.utils"; | 978 | + public static final String YANG_AUGMENTED_INFO_CLASS_IMPORT_PKG = "org.onosproject.yangutils.datamodel"; |
| 1024 | 979 | ||
| 1025 | /** | 980 | /** |
| 1026 | * Static attribute for AugmentedInfo class import class. | 981 | * Static attribute for AugmentedInfo class import class. |
| 1027 | */ | 982 | */ |
| 1028 | - public static final String AUGMENTED_INFO_CLASS_IMPORT_CLASS = "AugmentedInfo;\n"; | 983 | + public static final String YANG_AUGMENTED_INFO_CLASS_IMPORT_CLASS = "YangAugmentedInfo;\n"; |
| 1029 | 984 | ||
| 1030 | /** | 985 | /** |
| 1031 | * Static attribute for augmentation class. | 986 | * Static attribute for augmentation class. |
| ... | @@ -1033,19 +988,14 @@ public final class UtilConstants { | ... | @@ -1033,19 +988,14 @@ public final class UtilConstants { |
| 1033 | public static final String AUGMENTATION = "Augmentation"; | 988 | public static final String AUGMENTATION = "Augmentation"; |
| 1034 | 989 | ||
| 1035 | /** | 990 | /** |
| 1036 | - * Static attribute for AugmentationHolder class. | ||
| 1037 | - */ | ||
| 1038 | - public static final String AUGMENTATION_HOLDER = "AugmentationHolder"; | ||
| 1039 | - | ||
| 1040 | - /** | ||
| 1041 | * Static attribute for AugmentedInfo class. | 991 | * Static attribute for AugmentedInfo class. |
| 1042 | */ | 992 | */ |
| 1043 | - public static final String AUGMENTED_INFO = "AugmentedInfo"; | 993 | + public static final String YANG_AUGMENTED_INFO = "YangAugmentedInfo"; |
| 1044 | 994 | ||
| 1045 | /** | 995 | /** |
| 1046 | - * Static attribute for augmentable. | 996 | + * Static attribute for augmented. |
| 1047 | */ | 997 | */ |
| 1048 | - public static final String AUGMENTABLE = "Augmentable"; | 998 | + public static final String AUGMENTED = "Augmented"; |
| 1049 | 999 | ||
| 1050 | /** | 1000 | /** |
| 1051 | * Static attribute for list. | 1001 | * Static attribute for list. |
| ... | @@ -1053,11 +1003,6 @@ public final class UtilConstants { | ... | @@ -1053,11 +1003,6 @@ public final class UtilConstants { |
| 1053 | public static final String LIST = "List"; | 1003 | public static final String LIST = "List"; |
| 1054 | 1004 | ||
| 1055 | /** | 1005 | /** |
| 1056 | - * Static attribute for array list. | ||
| 1057 | - */ | ||
| 1058 | - public static final String ARRAY_LIST = "ArrayList"; | ||
| 1059 | - | ||
| 1060 | - /** | ||
| 1061 | * Comment to be added for autogenerated impl methods. | 1006 | * Comment to be added for autogenerated impl methods. |
| 1062 | */ | 1007 | */ |
| 1063 | public static final String YANG_UTILS_TODO = "//TODO: YANG utils generated code"; | 1008 | public static final String YANG_UTILS_TODO = "//TODO: YANG utils generated code"; |
| ... | @@ -1166,16 +1111,6 @@ public final class UtilConstants { | ... | @@ -1166,16 +1111,6 @@ public final class UtilConstants { |
| 1166 | public static final String EVENT_LISTENER = "EventListener"; | 1111 | public static final String EVENT_LISTENER = "EventListener"; |
| 1167 | 1112 | ||
| 1168 | /** | 1113 | /** |
| 1169 | - * Static attribute for YANG types package. | ||
| 1170 | - */ | ||
| 1171 | - public static final String YANG_TYPES_PKG = "org.onosproject.yangutils.datamodel.utils.builtindatatype"; | ||
| 1172 | - | ||
| 1173 | - /** | ||
| 1174 | - * Static attribute for MathContext class. | ||
| 1175 | - */ | ||
| 1176 | - public static final String MATH_CONTEXT = "MathContext"; | ||
| 1177 | - | ||
| 1178 | - /** | ||
| 1179 | * Static attribute for YANG file error. | 1114 | * Static attribute for YANG file error. |
| 1180 | */ | 1115 | */ |
| 1181 | public static final String YANG_FILE_ERROR = "YANG file error : "; | 1116 | public static final String YANG_FILE_ERROR = "YANG file error : "; | ... | ... |
| ... | @@ -16,11 +16,13 @@ | ... | @@ -16,11 +16,13 @@ |
| 16 | 16 | ||
| 17 | package org.onosproject.yangutils.utils.io.impl; | 17 | package org.onosproject.yangutils.utils.io.impl; |
| 18 | 18 | ||
| 19 | -import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCamelCase; | 19 | +import static org.onosproject.yangutils.utils.UtilConstants.AUGMENTED; |
| 20 | +import static org.onosproject.yangutils.utils.UtilConstants.YANG_AUGMENTED_INFO; | ||
| 20 | import static org.onosproject.yangutils.utils.UtilConstants.BUILDER; | 21 | import static org.onosproject.yangutils.utils.UtilConstants.BUILDER; |
| 21 | import static org.onosproject.yangutils.utils.UtilConstants.BUILDER_CLASS_JAVA_DOC; | 22 | import static org.onosproject.yangutils.utils.UtilConstants.BUILDER_CLASS_JAVA_DOC; |
| 22 | import static org.onosproject.yangutils.utils.UtilConstants.BUILDER_INTERFACE_JAVA_DOC; | 23 | import static org.onosproject.yangutils.utils.UtilConstants.BUILDER_INTERFACE_JAVA_DOC; |
| 23 | import static org.onosproject.yangutils.utils.UtilConstants.BUILDER_OBJECT; | 24 | import static org.onosproject.yangutils.utils.UtilConstants.BUILDER_OBJECT; |
| 25 | +import static org.onosproject.yangutils.utils.UtilConstants.CLASS; | ||
| 24 | import static org.onosproject.yangutils.utils.UtilConstants.EMPTY_STRING; | 26 | import static org.onosproject.yangutils.utils.UtilConstants.EMPTY_STRING; |
| 25 | import static org.onosproject.yangutils.utils.UtilConstants.ENUM_ATTRIBUTE_JAVADOC; | 27 | import static org.onosproject.yangutils.utils.UtilConstants.ENUM_ATTRIBUTE_JAVADOC; |
| 26 | import static org.onosproject.yangutils.utils.UtilConstants.ENUM_CLASS_JAVADOC; | 28 | import static org.onosproject.yangutils.utils.UtilConstants.ENUM_CLASS_JAVADOC; |
| ... | @@ -47,9 +49,11 @@ import static org.onosproject.yangutils.utils.UtilConstants.JAVA_DOC_RPC; | ... | @@ -47,9 +49,11 @@ import static org.onosproject.yangutils.utils.UtilConstants.JAVA_DOC_RPC; |
| 47 | import static org.onosproject.yangutils.utils.UtilConstants.JAVA_DOC_SETTERS; | 49 | import static org.onosproject.yangutils.utils.UtilConstants.JAVA_DOC_SETTERS; |
| 48 | import static org.onosproject.yangutils.utils.UtilConstants.JAVA_DOC_SETTERS_COMMON; | 50 | import static org.onosproject.yangutils.utils.UtilConstants.JAVA_DOC_SETTERS_COMMON; |
| 49 | import static org.onosproject.yangutils.utils.UtilConstants.LIST; | 51 | import static org.onosproject.yangutils.utils.UtilConstants.LIST; |
| 52 | +import static org.onosproject.yangutils.utils.UtilConstants.MAP; | ||
| 50 | import static org.onosproject.yangutils.utils.UtilConstants.NEW_LINE; | 53 | import static org.onosproject.yangutils.utils.UtilConstants.NEW_LINE; |
| 51 | import static org.onosproject.yangutils.utils.UtilConstants.NEW_LINE_ASTERISK; | 54 | import static org.onosproject.yangutils.utils.UtilConstants.NEW_LINE_ASTERISK; |
| 52 | import static org.onosproject.yangutils.utils.UtilConstants.OBJECT; | 55 | import static org.onosproject.yangutils.utils.UtilConstants.OBJECT; |
| 56 | +import static org.onosproject.yangutils.utils.UtilConstants.OBJECT_STRING; | ||
| 53 | import static org.onosproject.yangutils.utils.UtilConstants.OF; | 57 | import static org.onosproject.yangutils.utils.UtilConstants.OF; |
| 54 | import static org.onosproject.yangutils.utils.UtilConstants.PACKAGE_INFO_JAVADOC; | 58 | import static org.onosproject.yangutils.utils.UtilConstants.PACKAGE_INFO_JAVADOC; |
| 55 | import static org.onosproject.yangutils.utils.UtilConstants.PACKAGE_INFO_JAVADOC_OF_CHILD; | 59 | import static org.onosproject.yangutils.utils.UtilConstants.PACKAGE_INFO_JAVADOC_OF_CHILD; |
| ... | @@ -60,6 +64,8 @@ import static org.onosproject.yangutils.utils.UtilConstants.SPACE; | ... | @@ -60,6 +64,8 @@ import static org.onosproject.yangutils.utils.UtilConstants.SPACE; |
| 60 | import static org.onosproject.yangutils.utils.UtilConstants.STRING_DATA_TYPE; | 64 | import static org.onosproject.yangutils.utils.UtilConstants.STRING_DATA_TYPE; |
| 61 | import static org.onosproject.yangutils.utils.UtilConstants.VALUE; | 65 | import static org.onosproject.yangutils.utils.UtilConstants.VALUE; |
| 62 | import static org.onosproject.yangutils.utils.UtilConstants.VOID; | 66 | import static org.onosproject.yangutils.utils.UtilConstants.VOID; |
| 67 | +import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCamelCase; | ||
| 68 | +import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getSmallCase; | ||
| 63 | 69 | ||
| 64 | /** | 70 | /** |
| 65 | * Represents javadoc for the generated classes. | 71 | * Represents javadoc for the generated classes. |
| ... | @@ -73,127 +79,11 @@ public final class JavaDocGen { | ... | @@ -73,127 +79,11 @@ public final class JavaDocGen { |
| 73 | } | 79 | } |
| 74 | 80 | ||
| 75 | /** | 81 | /** |
| 76 | - * JavaDocs types. | ||
| 77 | - */ | ||
| 78 | - public enum JavaDocType { | ||
| 79 | - | ||
| 80 | - /** | ||
| 81 | - * For class. | ||
| 82 | - */ | ||
| 83 | - IMPL_CLASS, | ||
| 84 | - | ||
| 85 | - /** | ||
| 86 | - * For builder class. | ||
| 87 | - */ | ||
| 88 | - BUILDER_CLASS, | ||
| 89 | - | ||
| 90 | - /** | ||
| 91 | - * For interface. | ||
| 92 | - */ | ||
| 93 | - INTERFACE, | ||
| 94 | - | ||
| 95 | - /** | ||
| 96 | - * For builder interface. | ||
| 97 | - */ | ||
| 98 | - BUILDER_INTERFACE, | ||
| 99 | - | ||
| 100 | - /** | ||
| 101 | - * For package-info. | ||
| 102 | - */ | ||
| 103 | - PACKAGE_INFO, | ||
| 104 | - | ||
| 105 | - /** | ||
| 106 | - * For getters. | ||
| 107 | - */ | ||
| 108 | - GETTER_METHOD, | ||
| 109 | - | ||
| 110 | - /** | ||
| 111 | - * For rpc service. | ||
| 112 | - */ | ||
| 113 | - RPC_INTERFACE, | ||
| 114 | - | ||
| 115 | - /** | ||
| 116 | - * For rpc manager. | ||
| 117 | - */ | ||
| 118 | - RPC_MANAGER, | ||
| 119 | - | ||
| 120 | - /** | ||
| 121 | - * For event. | ||
| 122 | - */ | ||
| 123 | - EVENT, | ||
| 124 | - | ||
| 125 | - /** | ||
| 126 | - * For event listener. | ||
| 127 | - */ | ||
| 128 | - EVENT_LISTENER, | ||
| 129 | - | ||
| 130 | - /** | ||
| 131 | - * For setters. | ||
| 132 | - */ | ||
| 133 | - SETTER_METHOD, | ||
| 134 | - | ||
| 135 | - /** | ||
| 136 | - * For type def's setters. | ||
| 137 | - */ | ||
| 138 | - TYPE_DEF_SETTER_METHOD, | ||
| 139 | - | ||
| 140 | - /** | ||
| 141 | - * For of method. | ||
| 142 | - */ | ||
| 143 | - OF_METHOD, | ||
| 144 | - | ||
| 145 | - /** | ||
| 146 | - * For default constructor. | ||
| 147 | - */ | ||
| 148 | - DEFAULT_CONSTRUCTOR, | ||
| 149 | - | ||
| 150 | - /** | ||
| 151 | - * For constructor. | ||
| 152 | - */ | ||
| 153 | - CONSTRUCTOR, | ||
| 154 | - | ||
| 155 | - /** | ||
| 156 | - * For from method. | ||
| 157 | - */ | ||
| 158 | - FROM_METHOD, | ||
| 159 | - | ||
| 160 | - /** | ||
| 161 | - * For type constructor. | ||
| 162 | - */ | ||
| 163 | - TYPE_CONSTRUCTOR, | ||
| 164 | - | ||
| 165 | - /** | ||
| 166 | - * For build. | ||
| 167 | - */ | ||
| 168 | - BUILD_METHOD, | ||
| 169 | - | ||
| 170 | - /** | ||
| 171 | - * For enum. | ||
| 172 | - */ | ||
| 173 | - ENUM_CLASS, | ||
| 174 | - | ||
| 175 | - /** | ||
| 176 | - * For enum's attributes. | ||
| 177 | - */ | ||
| 178 | - ENUM_ATTRIBUTE, | ||
| 179 | - | ||
| 180 | - /** | ||
| 181 | - * For manager setters. | ||
| 182 | - */ | ||
| 183 | - MANAGER_SETTER_METHOD, | ||
| 184 | - | ||
| 185 | - /** | ||
| 186 | - * For event subject. | ||
| 187 | - */ | ||
| 188 | - EVENT_SUBJECT_CLASS | ||
| 189 | - } | ||
| 190 | - | ||
| 191 | - /** | ||
| 192 | * Returns java docs. | 82 | * Returns java docs. |
| 193 | * | 83 | * |
| 194 | - * @param type java doc type | 84 | + * @param type java doc type |
| 195 | - * @param name name of the YangNode | 85 | + * @param name name of the YangNode |
| 196 | - * @param isList is list attribute | 86 | + * @param isList is list attribute |
| 197 | * @param pluginConfig plugin configurations | 87 | * @param pluginConfig plugin configurations |
| 198 | * @return javadocs. | 88 | * @return javadocs. |
| 199 | */ | 89 | */ |
| ... | @@ -250,10 +140,10 @@ public final class JavaDocGen { | ... | @@ -250,10 +140,10 @@ public final class JavaDocGen { |
| 250 | return generateForEnumAttr(name); | 140 | return generateForEnumAttr(name); |
| 251 | } | 141 | } |
| 252 | case RPC_INTERFACE: { | 142 | case RPC_INTERFACE: { |
| 253 | - return generateForRpcService(name); | 143 | + return generateForRpcService(name); |
| 254 | } | 144 | } |
| 255 | case RPC_MANAGER: { | 145 | case RPC_MANAGER: { |
| 256 | - return generateForClass(name); | 146 | + return generateForClass(name); |
| 257 | } | 147 | } |
| 258 | case EVENT: { | 148 | case EVENT: { |
| 259 | return generateForEvent(name); | 149 | return generateForEvent(name); |
| ... | @@ -284,14 +174,14 @@ public final class JavaDocGen { | ... | @@ -284,14 +174,14 @@ public final class JavaDocGen { |
| 284 | /** | 174 | /** |
| 285 | * Generates javaDocs for rpc method. | 175 | * Generates javaDocs for rpc method. |
| 286 | * | 176 | * |
| 287 | - * @param rpcName name of the rpc | 177 | + * @param rpcName name of the rpc |
| 288 | - * @param inputName name of input | 178 | + * @param inputName name of input |
| 289 | - * @param outputName name of output | 179 | + * @param outputName name of output |
| 290 | * @param pluginConfig plugin configurations | 180 | * @param pluginConfig plugin configurations |
| 291 | * @return javaDocs of rpc method | 181 | * @return javaDocs of rpc method |
| 292 | */ | 182 | */ |
| 293 | public static String generateJavaDocForRpc(String rpcName, String inputName, String outputName, | 183 | public static String generateJavaDocForRpc(String rpcName, String inputName, String outputName, |
| 294 | - YangPluginConfig pluginConfig) { | 184 | + YangPluginConfig pluginConfig) { |
| 295 | rpcName = getCamelCase(rpcName, pluginConfig.getConflictResolver()); | 185 | rpcName = getCamelCase(rpcName, pluginConfig.getConflictResolver()); |
| 296 | 186 | ||
| 297 | String javadoc = | 187 | String javadoc = |
| ... | @@ -310,7 +200,7 @@ public final class JavaDocGen { | ... | @@ -310,7 +200,7 @@ public final class JavaDocGen { |
| 310 | * Returns output string of rpc. | 200 | * Returns output string of rpc. |
| 311 | * | 201 | * |
| 312 | * @param outputName name of output | 202 | * @param outputName name of output |
| 313 | - * @param rpcName name of rpc | 203 | + * @param rpcName name of rpc |
| 314 | * @return javaDocs for output string of rpc | 204 | * @return javaDocs for output string of rpc |
| 315 | */ | 205 | */ |
| 316 | private static String getOutputString(String outputName, String rpcName) { | 206 | private static String getOutputString(String outputName, String rpcName) { |
| ... | @@ -321,7 +211,7 @@ public final class JavaDocGen { | ... | @@ -321,7 +211,7 @@ public final class JavaDocGen { |
| 321 | * Returns input string of rpc. | 211 | * Returns input string of rpc. |
| 322 | * | 212 | * |
| 323 | * @param inputName name of input | 213 | * @param inputName name of input |
| 324 | - * @param rpcName name of rpc | 214 | + * @param rpcName name of rpc |
| 325 | * @return javaDocs for input string of rpc | 215 | * @return javaDocs for input string of rpc |
| 326 | */ | 216 | */ |
| 327 | private static String getInputString(String inputName, String rpcName) { | 217 | private static String getInputString(String inputName, String rpcName) { |
| ... | @@ -369,7 +259,7 @@ public final class JavaDocGen { | ... | @@ -369,7 +259,7 @@ public final class JavaDocGen { |
| 369 | * Generates javaDocs for getter method. | 259 | * Generates javaDocs for getter method. |
| 370 | * | 260 | * |
| 371 | * @param attribute attribute | 261 | * @param attribute attribute |
| 372 | - * @param isList is list attribute | 262 | + * @param isList is list attribute |
| 373 | * @return javaDocs | 263 | * @return javaDocs |
| 374 | */ | 264 | */ |
| 375 | private static String generateForGetters(String attribute, boolean isList) { | 265 | private static String generateForGetters(String attribute, boolean isList) { |
| ... | @@ -392,7 +282,7 @@ public final class JavaDocGen { | ... | @@ -392,7 +282,7 @@ public final class JavaDocGen { |
| 392 | * Generates javaDocs for setter method. | 282 | * Generates javaDocs for setter method. |
| 393 | * | 283 | * |
| 394 | * @param attribute attribute | 284 | * @param attribute attribute |
| 395 | - * @param isList is list attribute | 285 | + * @param isList is list attribute |
| 396 | * @return javaDocs | 286 | * @return javaDocs |
| 397 | */ | 287 | */ |
| 398 | private static String generateForSetters(String attribute, boolean isList) { | 288 | private static String generateForSetters(String attribute, boolean isList) { |
| ... | @@ -416,7 +306,7 @@ public final class JavaDocGen { | ... | @@ -416,7 +306,7 @@ public final class JavaDocGen { |
| 416 | * Generates javaDocs for setter method. | 306 | * Generates javaDocs for setter method. |
| 417 | * | 307 | * |
| 418 | * @param attribute attribute | 308 | * @param attribute attribute |
| 419 | - * @param isList is list attribute | 309 | + * @param isList is list attribute |
| 420 | * @return javaDocs | 310 | * @return javaDocs |
| 421 | */ | 311 | */ |
| 422 | private static String generateForManagerSetters(String attribute, boolean isList) { | 312 | private static String generateForManagerSetters(String attribute, boolean isList) { |
| ... | @@ -596,4 +486,143 @@ public final class JavaDocGen { | ... | @@ -596,4 +486,143 @@ public final class JavaDocGen { |
| 596 | + JAVA_DOC_PARAM + VALUE + SPACE + VALUE + SPACE + OF + SPACE + attribute + NEW_LINE | 486 | + JAVA_DOC_PARAM + VALUE + SPACE + VALUE + SPACE + OF + SPACE + attribute + NEW_LINE |
| 597 | + FOUR_SPACE_INDENTATION + JAVA_DOC_END_LINE; | 487 | + FOUR_SPACE_INDENTATION + JAVA_DOC_END_LINE; |
| 598 | } | 488 | } |
| 489 | + | ||
| 490 | + /** | ||
| 491 | + * Generates javaDocs for add augmentation method. | ||
| 492 | + * | ||
| 493 | + * @return javaDocs | ||
| 494 | + */ | ||
| 495 | + public static String generateForAddAugmentation() { | ||
| 496 | + return NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_FIRST_LINE + FOUR_SPACE_INDENTATION | ||
| 497 | + + JAVA_DOC_SETTERS_COMMON + getSmallCase(YANG_AUGMENTED_INFO) + MAP + PERIOD + NEW_LINE + | ||
| 498 | + FOUR_SPACE_INDENTATION + NEW_LINE_ASTERISK + FOUR_SPACE_INDENTATION + JAVA_DOC_PARAM + VALUE + SPACE + | ||
| 499 | + VALUE + SPACE + OF + SPACE + getSmallCase(YANG_AUGMENTED_INFO) + NEW_LINE + FOUR_SPACE_INDENTATION | ||
| 500 | + + JAVA_DOC_PARAM + CLASS + OBJECT_STRING + SPACE + | ||
| 501 | + VALUE + SPACE + OF + SPACE + AUGMENTED + CLASS + NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_END_LINE; | ||
| 502 | + } | ||
| 503 | + | ||
| 504 | + public static String generateForGetAugmentation() { | ||
| 505 | + return NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_FIRST_LINE + FOUR_SPACE_INDENTATION | ||
| 506 | + + JAVA_DOC_GETTERS + getSmallCase(YANG_AUGMENTED_INFO) + PERIOD + NEW_LINE + | ||
| 507 | + FOUR_SPACE_INDENTATION + NEW_LINE_ASTERISK + FOUR_SPACE_INDENTATION + JAVA_DOC_PARAM + CLASS + | ||
| 508 | + OBJECT_STRING + SPACE + VALUE + SPACE + OF + SPACE + AUGMENTED + CLASS + NEW_LINE + | ||
| 509 | + FOUR_SPACE_INDENTATION + JAVA_DOC_RETURN + VALUE + SPACE + | ||
| 510 | + OF + SPACE + YANG_AUGMENTED_INFO + NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_END_LINE; | ||
| 511 | + } | ||
| 512 | + | ||
| 513 | + /** | ||
| 514 | + * JavaDocs types. | ||
| 515 | + */ | ||
| 516 | + public enum JavaDocType { | ||
| 517 | + | ||
| 518 | + /** | ||
| 519 | + * For class. | ||
| 520 | + */ | ||
| 521 | + IMPL_CLASS, | ||
| 522 | + | ||
| 523 | + /** | ||
| 524 | + * For builder class. | ||
| 525 | + */ | ||
| 526 | + BUILDER_CLASS, | ||
| 527 | + | ||
| 528 | + /** | ||
| 529 | + * For interface. | ||
| 530 | + */ | ||
| 531 | + INTERFACE, | ||
| 532 | + | ||
| 533 | + /** | ||
| 534 | + * For builder interface. | ||
| 535 | + */ | ||
| 536 | + BUILDER_INTERFACE, | ||
| 537 | + | ||
| 538 | + /** | ||
| 539 | + * For package-info. | ||
| 540 | + */ | ||
| 541 | + PACKAGE_INFO, | ||
| 542 | + | ||
| 543 | + /** | ||
| 544 | + * For getters. | ||
| 545 | + */ | ||
| 546 | + GETTER_METHOD, | ||
| 547 | + | ||
| 548 | + /** | ||
| 549 | + * For rpc service. | ||
| 550 | + */ | ||
| 551 | + RPC_INTERFACE, | ||
| 552 | + | ||
| 553 | + /** | ||
| 554 | + * For rpc manager. | ||
| 555 | + */ | ||
| 556 | + RPC_MANAGER, | ||
| 557 | + | ||
| 558 | + /** | ||
| 559 | + * For event. | ||
| 560 | + */ | ||
| 561 | + EVENT, | ||
| 562 | + | ||
| 563 | + /** | ||
| 564 | + * For event listener. | ||
| 565 | + */ | ||
| 566 | + EVENT_LISTENER, | ||
| 567 | + | ||
| 568 | + /** | ||
| 569 | + * For setters. | ||
| 570 | + */ | ||
| 571 | + SETTER_METHOD, | ||
| 572 | + | ||
| 573 | + /** | ||
| 574 | + * For type def's setters. | ||
| 575 | + */ | ||
| 576 | + TYPE_DEF_SETTER_METHOD, | ||
| 577 | + | ||
| 578 | + /** | ||
| 579 | + * For of method. | ||
| 580 | + */ | ||
| 581 | + OF_METHOD, | ||
| 582 | + | ||
| 583 | + /** | ||
| 584 | + * For default constructor. | ||
| 585 | + */ | ||
| 586 | + DEFAULT_CONSTRUCTOR, | ||
| 587 | + | ||
| 588 | + /** | ||
| 589 | + * For constructor. | ||
| 590 | + */ | ||
| 591 | + CONSTRUCTOR, | ||
| 592 | + | ||
| 593 | + /** | ||
| 594 | + * For from method. | ||
| 595 | + */ | ||
| 596 | + FROM_METHOD, | ||
| 597 | + | ||
| 598 | + /** | ||
| 599 | + * For type constructor. | ||
| 600 | + */ | ||
| 601 | + TYPE_CONSTRUCTOR, | ||
| 602 | + | ||
| 603 | + /** | ||
| 604 | + * For build. | ||
| 605 | + */ | ||
| 606 | + BUILD_METHOD, | ||
| 607 | + | ||
| 608 | + /** | ||
| 609 | + * For enum. | ||
| 610 | + */ | ||
| 611 | + ENUM_CLASS, | ||
| 612 | + | ||
| 613 | + /** | ||
| 614 | + * For enum's attributes. | ||
| 615 | + */ | ||
| 616 | + ENUM_ATTRIBUTE, | ||
| 617 | + | ||
| 618 | + /** | ||
| 619 | + * For manager setters. | ||
| 620 | + */ | ||
| 621 | + MANAGER_SETTER_METHOD, | ||
| 622 | + | ||
| 623 | + /** | ||
| 624 | + * For event subject. | ||
| 625 | + */ | ||
| 626 | + EVENT_SUBJECT_CLASS | ||
| 627 | + } | ||
| 599 | } | 628 | } | ... | ... |
| ... | @@ -103,7 +103,7 @@ public final class YangIoUtils { | ... | @@ -103,7 +103,7 @@ public final class YangIoUtils { |
| 103 | * @throws IOException when fails to create package info file | 103 | * @throws IOException when fails to create package info file |
| 104 | */ | 104 | */ |
| 105 | public static void addPackageInfo(File path, String classInfo, String pack, boolean isChildNode, | 105 | public static void addPackageInfo(File path, String classInfo, String pack, boolean isChildNode, |
| 106 | - YangPluginConfig pluginConfig) | 106 | + YangPluginConfig pluginConfig) |
| 107 | throws IOException { | 107 | throws IOException { |
| 108 | 108 | ||
| 109 | pack = parsePkg(pack); | 109 | pack = parsePkg(pack); |
| ... | @@ -385,7 +385,7 @@ public final class YangIoUtils { | ... | @@ -385,7 +385,7 @@ public final class YangIoUtils { |
| 385 | 385 | ||
| 386 | /* Updates the given line with the given size conditions. */ | 386 | /* Updates the given line with the given size conditions. */ |
| 387 | private static StringBuilder updateString(String[] strArray, StringBuilder stringBuilder, String string, | 387 | private static StringBuilder updateString(String[] strArray, StringBuilder stringBuilder, String string, |
| 388 | - int lineSize) { | 388 | + int lineSize) { |
| 389 | 389 | ||
| 390 | StringBuilder tempBuilder = new StringBuilder(); | 390 | StringBuilder tempBuilder = new StringBuilder(); |
| 391 | for (String str : strArray) { | 391 | for (String str : strArray) { |
| ... | @@ -481,7 +481,7 @@ public final class YangIoUtils { | ... | @@ -481,7 +481,7 @@ public final class YangIoUtils { |
| 481 | /** | 481 | /** |
| 482 | * Adds prefix, if the string begins with digit or is a java key word. | 482 | * Adds prefix, if the string begins with digit or is a java key word. |
| 483 | * | 483 | * |
| 484 | - * @param camelCasePrefix string for adding prefix | 484 | + * @param camelCasePrefix string for adding prefix |
| 485 | * @param conflictResolver object of YANG to java naming conflict util | 485 | * @param conflictResolver object of YANG to java naming conflict util |
| 486 | * @return prefixed camel case string | 486 | * @return prefixed camel case string |
| 487 | */ | 487 | */ |
| ... | @@ -502,7 +502,7 @@ public final class YangIoUtils { | ... | @@ -502,7 +502,7 @@ public final class YangIoUtils { |
| 502 | * Applies the rule that a string does not end with a capitalized letter and capitalizes | 502 | * Applies the rule that a string does not end with a capitalized letter and capitalizes |
| 503 | * the letter next to a number in an array. | 503 | * the letter next to a number in an array. |
| 504 | * | 504 | * |
| 505 | - * @param stringArray containing strings for camel case separation | 505 | + * @param stringArray containing strings for camel case separation |
| 506 | * @param conflictResolver object of YANG to java naming conflict util | 506 | * @param conflictResolver object of YANG to java naming conflict util |
| 507 | * @return camel case rule checked string | 507 | * @return camel case rule checked string |
| 508 | */ | 508 | */ |
| ... | @@ -545,7 +545,7 @@ public final class YangIoUtils { | ... | @@ -545,7 +545,7 @@ public final class YangIoUtils { |
| 545 | /** | 545 | /** |
| 546 | * Resolves the conflict when input has upper case. | 546 | * Resolves the conflict when input has upper case. |
| 547 | * | 547 | * |
| 548 | - * @param stringArray containing strings for upper case conflict resolver | 548 | + * @param stringArray containing strings for upper case conflict resolver |
| 549 | * @param conflictResolver object of YANG to java naming conflict util | 549 | * @param conflictResolver object of YANG to java naming conflict util |
| 550 | * @return camel cased string | 550 | * @return camel cased string |
| 551 | */ | 551 | */ |
| ... | @@ -597,7 +597,7 @@ public final class YangIoUtils { | ... | @@ -597,7 +597,7 @@ public final class YangIoUtils { |
| 597 | /** | 597 | /** |
| 598 | * Returns the YANG identifier name as java identifier. | 598 | * Returns the YANG identifier name as java identifier. |
| 599 | * | 599 | * |
| 600 | - * @param yangIdentifier identifier in YANG file | 600 | + * @param yangIdentifier identifier in YANG file |
| 601 | * @param conflictResolver object of YANG to java naming conflict util | 601 | * @param conflictResolver object of YANG to java naming conflict util |
| 602 | * @return corresponding java identifier | 602 | * @return corresponding java identifier |
| 603 | */ | 603 | */ | ... | ... |
| ... | @@ -206,7 +206,7 @@ public class InterJarLinkerTest { | ... | @@ -206,7 +206,7 @@ public class InterJarLinkerTest { |
| 206 | File folder = new File(System.getProperty("user.dir") + SLASH + FLOW_CLASSIFIER_FOLDER); | 206 | File folder = new File(System.getProperty("user.dir") + SLASH + FLOW_CLASSIFIER_FOLDER); |
| 207 | File file = new File(System.getProperty("user.dir") + SLASH + FLOW_CLASSIFIER_MANAGER); | 207 | File file = new File(System.getProperty("user.dir") + SLASH + FLOW_CLASSIFIER_MANAGER); |
| 208 | assertThat(true, is(folder.exists())); | 208 | assertThat(true, is(folder.exists())); |
| 209 | - assertThat(false, is(file.exists())); | 209 | + assertThat(true, is(file.exists())); |
| 210 | } | 210 | } |
| 211 | 211 | ||
| 212 | /** | 212 | /** | ... | ... |
| ... | @@ -50,6 +50,7 @@ public final class NotificationTranslatorTest { | ... | @@ -50,6 +50,7 @@ public final class NotificationTranslatorTest { |
| 50 | generateJavaCode(node, yangPluginConfig); | 50 | generateJavaCode(node, yangPluginConfig); |
| 51 | 51 | ||
| 52 | deleteDirectory("target/NotificationTest/"); | 52 | deleteDirectory("target/NotificationTest/"); |
| 53 | + deleteDirectory("target/NotificationTest1/"); | ||
| 53 | } | 54 | } |
| 54 | 55 | ||
| 55 | // TODO enhance the test cases, after having a framework of translator test. | 56 | // TODO enhance the test cases, after having a framework of translator test. | ... | ... |
| ... | @@ -26,7 +26,6 @@ import org.onosproject.yangutils.datamodel.YangAugment; | ... | @@ -26,7 +26,6 @@ import org.onosproject.yangutils.datamodel.YangAugment; |
| 26 | import org.onosproject.yangutils.datamodel.YangNode; | 26 | import org.onosproject.yangutils.datamodel.YangNode; |
| 27 | import org.onosproject.yangutils.datamodel.YangReferenceResolver; | 27 | import org.onosproject.yangutils.datamodel.YangReferenceResolver; |
| 28 | import org.onosproject.yangutils.datamodel.YangResolutionInfo; | 28 | import org.onosproject.yangutils.datamodel.YangResolutionInfo; |
| 29 | -import org.onosproject.yangutils.linker.exceptions.LinkerException; | ||
| 30 | import org.onosproject.yangutils.linker.impl.YangLinkerManager; | 29 | import org.onosproject.yangutils.linker.impl.YangLinkerManager; |
| 31 | import org.onosproject.yangutils.linker.impl.YangXpathLinker; | 30 | import org.onosproject.yangutils.linker.impl.YangXpathLinker; |
| 32 | import org.onosproject.yangutils.utils.io.impl.YangFileScanner; | 31 | import org.onosproject.yangutils.utils.io.impl.YangFileScanner; |
| ... | @@ -44,11 +43,12 @@ public class YangXpathLinkerTest { | ... | @@ -44,11 +43,12 @@ public class YangXpathLinkerTest { |
| 44 | private YangLinkerManager linkerManager = new YangLinkerManager(); | 43 | private YangLinkerManager linkerManager = new YangLinkerManager(); |
| 45 | private static final String INTRA_FILE_PATH = "src/test/resources/xPathLinker/IntraFile/"; | 44 | private static final String INTRA_FILE_PATH = "src/test/resources/xPathLinker/IntraFile/"; |
| 46 | private static final String INTER_FILE_PATH = "src/test/resources/xPathLinker/InterFile/"; | 45 | private static final String INTER_FILE_PATH = "src/test/resources/xPathLinker/InterFile/"; |
| 46 | + private static final String CASE_FILE_PATH = "src/test/resources/xPathLinker/Case/"; | ||
| 47 | 47 | ||
| 48 | /** | 48 | /** |
| 49 | * Unit test case for intra file linking for single level container. | 49 | * Unit test case for intra file linking for single level container. |
| 50 | * | 50 | * |
| 51 | - * @throws IOException when fails to do IO operations | 51 | + * @throws IOException when fails to do IO operations |
| 52 | * @throws MojoExecutionException | 52 | * @throws MojoExecutionException |
| 53 | */ | 53 | */ |
| 54 | @Test | 54 | @Test |
| ... | @@ -230,7 +230,7 @@ public class YangXpathLinkerTest { | ... | @@ -230,7 +230,7 @@ public class YangXpathLinkerTest { |
| 230 | * | 230 | * |
| 231 | * @throws IOException when fails to do IO operations | 231 | * @throws IOException when fails to do IO operations |
| 232 | */ | 232 | */ |
| 233 | - @Test(expected = LinkerException.class) | 233 | + @Test |
| 234 | public void processIntraFileLinkingInUsesSingleLevel() throws IOException { | 234 | public void processIntraFileLinkingInUsesSingleLevel() throws IOException { |
| 235 | 235 | ||
| 236 | utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTRA_FILE_PATH + "IntraSingleUses/")); | 236 | utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTRA_FILE_PATH + "IntraSingleUses/")); |
| ... | @@ -260,7 +260,7 @@ public class YangXpathLinkerTest { | ... | @@ -260,7 +260,7 @@ public class YangXpathLinkerTest { |
| 260 | * | 260 | * |
| 261 | * @throws IOException when fails to do IO operations | 261 | * @throws IOException when fails to do IO operations |
| 262 | */ | 262 | */ |
| 263 | - @Test(expected = LinkerException.class) | 263 | + @Test |
| 264 | public void processIntraFileLinkingInUsesMultiLevel() throws IOException { | 264 | public void processIntraFileLinkingInUsesMultiLevel() throws IOException { |
| 265 | 265 | ||
| 266 | utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTRA_FILE_PATH + "IntraMultiUses/")); | 266 | utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTRA_FILE_PATH + "IntraMultiUses/")); |
| ... | @@ -449,6 +449,9 @@ public class YangXpathLinkerTest { | ... | @@ -449,6 +449,9 @@ public class YangXpathLinkerTest { |
| 449 | utilManager.createYangNodeSet(); | 449 | utilManager.createYangNodeSet(); |
| 450 | linkerManager.createYangNodeSet(utilManager.getYangNodeSet()); | 450 | linkerManager.createYangNodeSet(utilManager.getYangNodeSet()); |
| 451 | linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet()); | 451 | linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet()); |
| 452 | + linkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet()); | ||
| 453 | + linkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet()); | ||
| 454 | + linkerManager.processInterFileLinking(utilManager.getYangNodeSet()); | ||
| 452 | 455 | ||
| 453 | YangNode targetNode = null; | 456 | YangNode targetNode = null; |
| 454 | String targetNodeName = null; | 457 | String targetNodeName = null; |
| ... | @@ -459,7 +462,7 @@ public class YangXpathLinkerTest { | ... | @@ -459,7 +462,7 @@ public class YangXpathLinkerTest { |
| 459 | for (YangAugment augment : augments) { | 462 | for (YangAugment augment : augments) { |
| 460 | targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier() | 463 | targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier() |
| 461 | .getName(); | 464 | .getName(); |
| 462 | - targetNode = linker.processAugmentXpathLinking(augment.getTargetNode(), node); | 465 | + targetNode = augment.getAugmentedNode(); |
| 463 | } | 466 | } |
| 464 | } | 467 | } |
| 465 | 468 | ||
| ... | @@ -481,7 +484,7 @@ public class YangXpathLinkerTest { | ... | @@ -481,7 +484,7 @@ public class YangXpathLinkerTest { |
| 481 | linkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet()); | 484 | linkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet()); |
| 482 | linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet()); | 485 | linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet()); |
| 483 | linkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet()); | 486 | linkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet()); |
| 484 | - | 487 | + linkerManager.processInterFileLinking(utilManager.getYangNodeSet()); |
| 485 | YangNode targetNode = null; | 488 | YangNode targetNode = null; |
| 486 | String targetNodeName = null; | 489 | String targetNodeName = null; |
| 487 | 490 | ||
| ... | @@ -491,7 +494,7 @@ public class YangXpathLinkerTest { | ... | @@ -491,7 +494,7 @@ public class YangXpathLinkerTest { |
| 491 | for (YangAugment augment : augments) { | 494 | for (YangAugment augment : augments) { |
| 492 | targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier() | 495 | targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier() |
| 493 | .getName(); | 496 | .getName(); |
| 494 | - targetNode = linker.processAugmentXpathLinking(augment.getTargetNode(), node); | 497 | + targetNode = augment.getAugmentedNode(); |
| 495 | } | 498 | } |
| 496 | } | 499 | } |
| 497 | 500 | ||
| ... | @@ -523,7 +526,7 @@ public class YangXpathLinkerTest { | ... | @@ -523,7 +526,7 @@ public class YangXpathLinkerTest { |
| 523 | for (YangAugment augment : augments) { | 526 | for (YangAugment augment : augments) { |
| 524 | targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier() | 527 | targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier() |
| 525 | .getName(); | 528 | .getName(); |
| 526 | - targetNode = linker.processAugmentXpathLinking(augment.getTargetNode(), node); | 529 | + targetNode = augment.getAugmentedNode(); |
| 527 | } | 530 | } |
| 528 | } | 531 | } |
| 529 | 532 | ||
| ... | @@ -538,11 +541,11 @@ public class YangXpathLinkerTest { | ... | @@ -538,11 +541,11 @@ public class YangXpathLinkerTest { |
| 538 | @Test | 541 | @Test |
| 539 | public void processInterFileLinkingInUsesInAugment() throws IOException { | 542 | public void processInterFileLinkingInUsesInAugment() throws IOException { |
| 540 | 543 | ||
| 541 | - /* FIXME: when uses cloning is done test it. | ||
| 542 | utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTER_FILE_PATH + "InterSingleUses/")); | 544 | utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTER_FILE_PATH + "InterSingleUses/")); |
| 543 | utilManager.parseYangFileInfoSet(); | 545 | utilManager.parseYangFileInfoSet(); |
| 544 | utilManager.createYangNodeSet(); | 546 | utilManager.createYangNodeSet(); |
| 545 | linkerManager.createYangNodeSet(utilManager.getYangNodeSet()); | 547 | linkerManager.createYangNodeSet(utilManager.getYangNodeSet()); |
| 548 | + linkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet()); | ||
| 546 | linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet()); | 549 | linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet()); |
| 547 | linkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet()); | 550 | linkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet()); |
| 548 | linkerManager.processInterFileLinking(utilManager.getYangNodeSet()); | 551 | linkerManager.processInterFileLinking(utilManager.getYangNodeSet()); |
| ... | @@ -555,13 +558,13 @@ public class YangXpathLinkerTest { | ... | @@ -555,13 +558,13 @@ public class YangXpathLinkerTest { |
| 555 | 558 | ||
| 556 | for (YangAugment augment : augments) { | 559 | for (YangAugment augment : augments) { |
| 557 | targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1) | 560 | targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1) |
| 558 | - .getNodeIdentifier().getName(); | 561 | + .getNodeIdentifier().getName(); |
| 559 | - targetNode = linker.processXpathLinking(augment.getTargetNode(), node); | 562 | + targetNode = augment.getAugmentedNode(); |
| 560 | } | 563 | } |
| 561 | } | 564 | } |
| 562 | 565 | ||
| 563 | assertThat(true, is(targetNode.getName().equals(targetNodeName))); | 566 | assertThat(true, is(targetNode.getName().equals(targetNodeName))); |
| 564 | - */ | 567 | + |
| 565 | } | 568 | } |
| 566 | 569 | ||
| 567 | /** | 570 | /** |
| ... | @@ -569,7 +572,7 @@ public class YangXpathLinkerTest { | ... | @@ -569,7 +572,7 @@ public class YangXpathLinkerTest { |
| 569 | * | 572 | * |
| 570 | * @throws IOException when fails to do IO operations | 573 | * @throws IOException when fails to do IO operations |
| 571 | */ | 574 | */ |
| 572 | - @Test(expected = LinkerException.class) | 575 | + @Test |
| 573 | public void processInterFileLinkingInUsesMultiLevel() throws IOException { | 576 | public void processInterFileLinkingInUsesMultiLevel() throws IOException { |
| 574 | 577 | ||
| 575 | utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTER_FILE_PATH + "InterMultiUses/")); | 578 | utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTER_FILE_PATH + "InterMultiUses/")); |
| ... | @@ -596,4 +599,72 @@ public class YangXpathLinkerTest { | ... | @@ -596,4 +599,72 @@ public class YangXpathLinkerTest { |
| 596 | assertThat(true, is(targetNode.getName().equals(targetNodeName))); | 599 | assertThat(true, is(targetNode.getName().equals(targetNodeName))); |
| 597 | } | 600 | } |
| 598 | 601 | ||
| 602 | + /** | ||
| 603 | + * Unit test case for inter file linking for multi level uses inside augment. | ||
| 604 | + * | ||
| 605 | + * @throws IOException when fails to do IO operations | ||
| 606 | + */ | ||
| 607 | + @Test | ||
| 608 | + public void processInterFileLinkingInMultipleSubmodules() throws IOException { | ||
| 609 | + | ||
| 610 | + utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(CASE_FILE_PATH + "submodule/")); | ||
| 611 | + utilManager.parseYangFileInfoSet(); | ||
| 612 | + utilManager.createYangNodeSet(); | ||
| 613 | + linkerManager.createYangNodeSet(utilManager.getYangNodeSet()); | ||
| 614 | + linkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet()); | ||
| 615 | + linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet()); | ||
| 616 | + linkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet()); | ||
| 617 | + linkerManager.processInterFileLinking(utilManager.getYangNodeSet()); | ||
| 618 | + | ||
| 619 | + YangNode targetNode = null; | ||
| 620 | + String targetNodeName = null; | ||
| 621 | + | ||
| 622 | + for (YangNode node : utilManager.getYangNodeSet()) { | ||
| 623 | + List<YangAugment> augments = linker.getListOfYangAugment(node); | ||
| 624 | + | ||
| 625 | + for (YangAugment augment : augments) { | ||
| 626 | + targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1) | ||
| 627 | + .getNodeIdentifier().getName(); | ||
| 628 | + targetNode = augment.getAugmentedNode(); | ||
| 629 | + } | ||
| 630 | + } | ||
| 631 | + | ||
| 632 | + assertThat(true, is(targetNode.getName().equals(targetNodeName))); | ||
| 633 | + | ||
| 634 | + } | ||
| 635 | + | ||
| 636 | + /** | ||
| 637 | + * Unit test case for inter file linking for multi level uses inside augment. | ||
| 638 | + * | ||
| 639 | + * @throws IOException when fails to do IO operations | ||
| 640 | + */ | ||
| 641 | + @Test | ||
| 642 | + public void processInterFileLinkingInMultipleUses() throws IOException { | ||
| 643 | + | ||
| 644 | + /** FIXME: once order of linking is done. | ||
| 645 | + utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(CASE_FILE_PATH + "uses/")); | ||
| 646 | + utilManager.parseYangFileInfoSet(); | ||
| 647 | + utilManager.createYangNodeSet(); | ||
| 648 | + linkerManager.createYangNodeSet(utilManager.getYangNodeSet()); | ||
| 649 | + linkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet()); | ||
| 650 | + linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet()); | ||
| 651 | + linkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet()); | ||
| 652 | + linkerManager.processInterFileLinking(utilManager.getYangNodeSet()); | ||
| 653 | + | ||
| 654 | + YangNode targetNode = null; | ||
| 655 | + String targetNodeName = null; | ||
| 656 | + | ||
| 657 | + for (YangNode node : utilManager.getYangNodeSet()) { | ||
| 658 | + List<YangAugment> augments = linker.getListOfYangAugment(node); | ||
| 659 | + | ||
| 660 | + for (YangAugment augment : augments) { | ||
| 661 | + targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1) | ||
| 662 | + .getNodeIdentifier().getName(); | ||
| 663 | + targetNode = augment.getAugmentedNode(); | ||
| 664 | + } | ||
| 665 | + } | ||
| 666 | + | ||
| 667 | + assertThat(true, is(targetNode.getName().equals(targetNodeName))); | ||
| 668 | + */ | ||
| 669 | + } | ||
| 599 | } | 670 | } | ... | ... |
| ... | @@ -113,8 +113,6 @@ public final class JavaIdentifierSyntaxTest { | ... | @@ -113,8 +113,6 @@ public final class JavaIdentifierSyntaxTest { |
| 113 | private static final String BASE_DIR_PKG = "target.UnitTestCase."; | 113 | private static final String BASE_DIR_PKG = "target.UnitTestCase."; |
| 114 | private static final String DIR_PATH = "exist1.exist2.exist3"; | 114 | private static final String DIR_PATH = "exist1.exist2.exist3"; |
| 115 | private static final String PKG_INFO = "package-info.java"; | 115 | private static final String PKG_INFO = "package-info.java"; |
| 116 | - private static final String BASE_PKG = "target/UnitTestCase"; | ||
| 117 | - private static final String TEST_DATA_1 = "This is to append a text to the file first1\n"; | ||
| 118 | 116 | ||
| 119 | /** | 117 | /** |
| 120 | * Unit test for private constructor. | 118 | * Unit test for private constructor. |
| ... | @@ -319,5 +317,6 @@ public final class JavaIdentifierSyntaxTest { | ... | @@ -319,5 +317,6 @@ public final class JavaIdentifierSyntaxTest { |
| 319 | assertThat(true, is(doesPackageExist(strPath))); | 317 | assertThat(true, is(doesPackageExist(strPath))); |
| 320 | createDir.delete(); | 318 | createDir.delete(); |
| 321 | deleteDirectory(createDir); | 319 | deleteDirectory(createDir); |
| 320 | + deleteDirectory(new File(BASE_DIR_PKG.replace(PERIOD, SLASH))); | ||
| 322 | } | 321 | } |
| 323 | } | 322 | } | ... | ... |
utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/utils/io/impl/FileSystemUtilTest.java
| ... | @@ -20,6 +20,8 @@ import java.io.File; | ... | @@ -20,6 +20,8 @@ import java.io.File; |
| 20 | import java.io.IOException; | 20 | import java.io.IOException; |
| 21 | import java.lang.reflect.Constructor; | 21 | import java.lang.reflect.Constructor; |
| 22 | import java.lang.reflect.InvocationTargetException; | 22 | import java.lang.reflect.InvocationTargetException; |
| 23 | + | ||
| 24 | +import org.apache.commons.io.FileUtils; | ||
| 23 | import org.junit.Test; | 25 | import org.junit.Test; |
| 24 | 26 | ||
| 25 | import static org.apache.commons.io.FileUtils.deleteDirectory; | 27 | import static org.apache.commons.io.FileUtils.deleteDirectory; |
| ... | @@ -84,5 +86,6 @@ public final class FileSystemUtilTest { | ... | @@ -84,5 +86,6 @@ public final class FileSystemUtilTest { |
| 84 | appendFileContents(createFile, createSourceFile); | 86 | appendFileContents(createFile, createSourceFile); |
| 85 | updateFileHandle(createFile, null, true); | 87 | updateFileHandle(createFile, null, true); |
| 86 | deleteDirectory(dir); | 88 | deleteDirectory(dir); |
| 89 | + FileUtils.deleteDirectory(new File(BASE_PKG)); | ||
| 87 | } | 90 | } |
| 88 | } | 91 | } | ... | ... |
| ... | @@ -67,7 +67,7 @@ public final class YangIoUtilsTest { | ... | @@ -67,7 +67,7 @@ public final class YangIoUtilsTest { |
| 67 | addPackageInfo(dirPath, CHECK1, CREATE_PATH, false, getStubPluginConfig()); | 67 | addPackageInfo(dirPath, CHECK1, CREATE_PATH, false, getStubPluginConfig()); |
| 68 | File filePath = new File(dirPath + File.separator + PKG_INFO); | 68 | File filePath = new File(dirPath + File.separator + PKG_INFO); |
| 69 | assertThat(filePath.isFile(), is(true)); | 69 | assertThat(filePath.isFile(), is(true)); |
| 70 | - FileUtils.deleteDirectory(dirPath); | 70 | + FileUtils.deleteDirectory(new File(BASE_DIR)); |
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | /** | 73 | /** |
| ... | @@ -83,7 +83,7 @@ public final class YangIoUtilsTest { | ... | @@ -83,7 +83,7 @@ public final class YangIoUtilsTest { |
| 83 | addPackageInfo(dirPath, CHECK1, PATH + CREATE_PATH, false, getStubPluginConfig()); | 83 | addPackageInfo(dirPath, CHECK1, PATH + CREATE_PATH, false, getStubPluginConfig()); |
| 84 | File filePath = new File(dirPath + File.separator + PKG_INFO); | 84 | File filePath = new File(dirPath + File.separator + PKG_INFO); |
| 85 | assertThat(filePath.isFile(), is(true)); | 85 | assertThat(filePath.isFile(), is(true)); |
| 86 | - FileUtils.deleteDirectory(dirPath); | 86 | + FileUtils.deleteDirectory(new File(BASE_DIR)); |
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | /** | 89 | /** |
| ... | @@ -99,7 +99,7 @@ public final class YangIoUtilsTest { | ... | @@ -99,7 +99,7 @@ public final class YangIoUtilsTest { |
| 99 | addPackageInfo(dirPath, CHECK1, PATH + CREATE_PATH, true, getStubPluginConfig()); | 99 | addPackageInfo(dirPath, CHECK1, PATH + CREATE_PATH, true, getStubPluginConfig()); |
| 100 | File filePath = new File(dirPath + File.separator + PKG_INFO); | 100 | File filePath = new File(dirPath + File.separator + PKG_INFO); |
| 101 | assertThat(filePath.isFile(), is(true)); | 101 | assertThat(filePath.isFile(), is(true)); |
| 102 | - FileUtils.deleteDirectory(dirPath); | 102 | + FileUtils.deleteDirectory(new File(BASE_DIR)); |
| 103 | } | 103 | } |
| 104 | 104 | ||
| 105 | /** | 105 | /** |
| ... | @@ -117,6 +117,7 @@ public final class YangIoUtilsTest { | ... | @@ -117,6 +117,7 @@ public final class YangIoUtilsTest { |
| 117 | File filePath1 = new File(dirPath + File.separator + PKG_INFO); | 117 | File filePath1 = new File(dirPath + File.separator + PKG_INFO); |
| 118 | assertThat(filePath1.isFile(), is(false)); | 118 | assertThat(filePath1.isFile(), is(false)); |
| 119 | FileUtils.deleteDirectory(dirPath); | 119 | FileUtils.deleteDirectory(dirPath); |
| 120 | + FileUtils.deleteDirectory(new File(BASE_DIR)); | ||
| 120 | } | 121 | } |
| 121 | 122 | ||
| 122 | /** | 123 | /** |
| ... | @@ -180,7 +181,7 @@ public final class YangIoUtilsTest { | ... | @@ -180,7 +181,7 @@ public final class YangIoUtilsTest { |
| 180 | 181 | ||
| 181 | File dirPath = createDirectories(CREATE_PATH); | 182 | File dirPath = createDirectories(CREATE_PATH); |
| 182 | assertThat(dirPath.isDirectory(), is(true)); | 183 | assertThat(dirPath.isDirectory(), is(true)); |
| 183 | - FileUtils.deleteDirectory(dirPath); | 184 | + FileUtils.deleteDirectory(new File(BASE_DIR)); |
| 184 | } | 185 | } |
| 185 | 186 | ||
| 186 | /** | 187 | /** | ... | ... |
| ... | @@ -2,10 +2,7 @@ submodule acme-types { | ... | @@ -2,10 +2,7 @@ submodule acme-types { |
| 2 | 2 | ||
| 3 | belongs-to "test" { | 3 | belongs-to "test" { |
| 4 | prefix "test"; | 4 | prefix "test"; |
| 5 | - } | 5 | + } |
| 6 | - import test1{ | ||
| 7 | - prefix test1; | ||
| 8 | - } | ||
| 9 | organization ""; | 6 | organization ""; |
| 10 | contact ""; | 7 | contact ""; |
| 11 | 8 | ... | ... |
| ... | @@ -1723,9 +1723,9 @@ | ... | @@ -1723,9 +1723,9 @@ |
| 1723 | uses tet:te-link-state-derived; | 1723 | uses tet:te-link-state-derived; |
| 1724 | } | 1724 | } |
| 1725 | 1725 | ||
| 1726 | - /* | 1726 | + |
| 1727 | augment "/te-link-event/te-link-attributes/underlay" { | 1727 | augment "/te-link-event/te-link-attributes/underlay" { |
| 1728 | description "Add state attributes to te-link underlay."; | 1728 | description "Add state attributes to te-link underlay."; |
| 1729 | uses te-link-state-underlay-attributes; | 1729 | uses te-link-state-underlay-attributes; |
| 1730 | - } */ | 1730 | + } |
| 1731 | } | 1731 | } | ... | ... |
| 1 | +module test { | ||
| 2 | + namespace "xpath:intra:single"; | ||
| 3 | + prefix test ; | ||
| 4 | + | ||
| 5 | + include test1; | ||
| 6 | + include test2; | ||
| 7 | + include test4; | ||
| 8 | + | ||
| 9 | + organization ""; | ||
| 10 | + contact ""; | ||
| 11 | + | ||
| 12 | + description | ||
| 13 | + "Defines basic service types for L3VPN service."; | ||
| 14 | + | ||
| 15 | + revision "2015-12-16" { | ||
| 16 | + reference ""; | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + augment /cont5/cont6 { | ||
| 20 | + leaf a { | ||
| 21 | + type int32; | ||
| 22 | + } | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + augment /cont3/cont4/cont8 { | ||
| 26 | + leaf a { | ||
| 27 | + type int32; | ||
| 28 | + } | ||
| 29 | + } | ||
| 30 | +} | ||
| 31 | + |
| 1 | +submodule test1 { | ||
| 2 | + | ||
| 3 | + belongs-to test { | ||
| 4 | + prefix test; | ||
| 5 | + } | ||
| 6 | + | ||
| 7 | + include test4; | ||
| 8 | + | ||
| 9 | + organization ""; | ||
| 10 | + contact ""; | ||
| 11 | + | ||
| 12 | + description | ||
| 13 | + "Defines basic service types for L3VPN service."; | ||
| 14 | + | ||
| 15 | + revision "2015-12-16" { | ||
| 16 | + reference ""; | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + container cont1 { | ||
| 20 | + leaf leaf1 { | ||
| 21 | + type int32; | ||
| 22 | + } | ||
| 23 | + container cont2 { | ||
| 24 | + leaf leaf2 { | ||
| 25 | + type int32; | ||
| 26 | + } | ||
| 27 | + } | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + augment /cont1/cont2 { | ||
| 31 | + container cont4 { | ||
| 32 | + leaf leaf1 { | ||
| 33 | + type int32; | ||
| 34 | + } | ||
| 35 | + } | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + augment /cont3/cont4 { | ||
| 39 | + container cont8 { | ||
| 40 | + leaf leaf8 { | ||
| 41 | + type int32; | ||
| 42 | + } | ||
| 43 | + } | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | +} | ||
| 47 | + |
| 1 | +submodule test2{ | ||
| 2 | + belongs-to test { | ||
| 3 | + prefix test; | ||
| 4 | + } | ||
| 5 | + | ||
| 6 | + include test1; | ||
| 7 | + organization ""; | ||
| 8 | + contact ""; | ||
| 9 | + | ||
| 10 | + description | ||
| 11 | + "Defines basic service types for L3VPN service."; | ||
| 12 | + | ||
| 13 | + revision "2015-12-16" { | ||
| 14 | + reference ""; | ||
| 15 | + } | ||
| 16 | + | ||
| 17 | + container cont5 { | ||
| 18 | + leaf leaf5 { | ||
| 19 | + type int32; | ||
| 20 | + } | ||
| 21 | + container cont6 { | ||
| 22 | + leaf leaf6 { | ||
| 23 | + type int32; | ||
| 24 | + } | ||
| 25 | + } | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + augment /cont1/cont2/cont4 { | ||
| 29 | + container cont10 { | ||
| 30 | + leaf leaf10 { | ||
| 31 | + type int32; | ||
| 32 | + } | ||
| 33 | + } | ||
| 34 | + } | ||
| 35 | +} | ||
| 36 | + |
| 1 | +submodule test4 { | ||
| 2 | + | ||
| 3 | + belongs-to test { | ||
| 4 | + prefix test; | ||
| 5 | + } | ||
| 6 | + | ||
| 7 | + organization ""; | ||
| 8 | + contact ""; | ||
| 9 | + | ||
| 10 | + description | ||
| 11 | + "Defines basic service types for L3VPN service."; | ||
| 12 | + | ||
| 13 | + revision "2015-12-16" { | ||
| 14 | + reference ""; | ||
| 15 | + } | ||
| 16 | + | ||
| 17 | + container cont3 { | ||
| 18 | + leaf leaf3 { | ||
| 19 | + type int32; | ||
| 20 | + } | ||
| 21 | + container cont4 { | ||
| 22 | + leaf leaf4 { | ||
| 23 | + type int32; | ||
| 24 | + } | ||
| 25 | + } | ||
| 26 | + } | ||
| 27 | +} | ||
| 28 | + |
| 1 | +module test { | ||
| 2 | + namespace "xpath:intra:single"; | ||
| 3 | + prefix test ; | ||
| 4 | + | ||
| 5 | + include test1; | ||
| 6 | + include test2; | ||
| 7 | + include test4; | ||
| 8 | + | ||
| 9 | + organization ""; | ||
| 10 | + contact ""; | ||
| 11 | + | ||
| 12 | + description | ||
| 13 | + "Defines basic service types for L3VPN service."; | ||
| 14 | + | ||
| 15 | + revision "2015-12-16" { | ||
| 16 | + reference ""; | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + augment /cont5/cont6/cont3/cont4 { | ||
| 20 | + leaf a { | ||
| 21 | + type int32; | ||
| 22 | + } | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + augment /group1/cont3/cont4/cont8 { | ||
| 26 | + leaf a { | ||
| 27 | + type int32; | ||
| 28 | + } | ||
| 29 | + } | ||
| 30 | +} | ||
| 31 | + |
| 1 | +submodule test1 { | ||
| 2 | + | ||
| 3 | + belongs-to test { | ||
| 4 | + prefix test; | ||
| 5 | + } | ||
| 6 | + | ||
| 7 | + include test4; | ||
| 8 | + | ||
| 9 | + organization ""; | ||
| 10 | + contact ""; | ||
| 11 | + | ||
| 12 | + description | ||
| 13 | + "Defines basic service types for L3VPN service."; | ||
| 14 | + | ||
| 15 | + revision "2015-12-16" { | ||
| 16 | + reference ""; | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + container cont1 { | ||
| 20 | + leaf leaf1 { | ||
| 21 | + type int32; | ||
| 22 | + } | ||
| 23 | + container cont2 { | ||
| 24 | + leaf leaf2 { | ||
| 25 | + type int32; | ||
| 26 | + } | ||
| 27 | + } | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + augment /cont1/cont2 { | ||
| 31 | + container cont4 { | ||
| 32 | + leaf leaf1 { | ||
| 33 | + type int32; | ||
| 34 | + } | ||
| 35 | + } | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + augment /group1/cont3/cont4 { | ||
| 39 | + container cont8 { | ||
| 40 | + leaf leaf8 { | ||
| 41 | + type int32; | ||
| 42 | + } | ||
| 43 | + } | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | +} | ||
| 47 | + |
| 1 | +submodule test2{ | ||
| 2 | + belongs-to test { | ||
| 3 | + prefix test; | ||
| 4 | + } | ||
| 5 | + | ||
| 6 | + include test1; | ||
| 7 | + include test4; | ||
| 8 | + | ||
| 9 | + organization ""; | ||
| 10 | + contact ""; | ||
| 11 | + | ||
| 12 | + description | ||
| 13 | + "Defines basic service types for L3VPN service."; | ||
| 14 | + | ||
| 15 | + revision "2015-12-16" { | ||
| 16 | + reference ""; | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + grouping group2 { | ||
| 20 | + container cont11 { | ||
| 21 | + } | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + container cont5 { | ||
| 25 | + leaf leaf5 { | ||
| 26 | + type int32; | ||
| 27 | + } | ||
| 28 | + container cont6 { | ||
| 29 | + leaf leaf6 { | ||
| 30 | + type int32; | ||
| 31 | + } | ||
| 32 | + uses group1; | ||
| 33 | + } | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + container ethernet { | ||
| 37 | + leaf leaf10 { | ||
| 38 | + type string; | ||
| 39 | + } | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + | ||
| 43 | + augment /ethernet { | ||
| 44 | + uses group2; | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + augment /cont1/cont2/cont4 { | ||
| 48 | + container cont10 { | ||
| 49 | + leaf leaf10 { | ||
| 50 | + type int32; | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + } | ||
| 54 | + } | ||
| 55 | +} | ||
| 56 | + |
| 1 | +submodule test4 { | ||
| 2 | + | ||
| 3 | + belongs-to test { | ||
| 4 | + prefix test; | ||
| 5 | + } | ||
| 6 | + | ||
| 7 | + include test2; | ||
| 8 | + organization ""; | ||
| 9 | + contact ""; | ||
| 10 | + | ||
| 11 | + description | ||
| 12 | + "Defines basic service types for L3VPN service."; | ||
| 13 | + | ||
| 14 | + revision "2015-12-16" { | ||
| 15 | + reference ""; | ||
| 16 | + } | ||
| 17 | + | ||
| 18 | + grouping group1 { | ||
| 19 | + container cont3 { | ||
| 20 | + leaf leaf3 { | ||
| 21 | + type int32; | ||
| 22 | + } | ||
| 23 | + container cont4 { | ||
| 24 | + leaf leaf4 { | ||
| 25 | + type int32; | ||
| 26 | + } | ||
| 27 | + } | ||
| 28 | + } | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + augment /ethernet/cont11 { | ||
| 32 | + leaf leaf11 { | ||
| 33 | + type int32; | ||
| 34 | + } | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | +} |
| ... | @@ -29,7 +29,7 @@ module test1 { | ... | @@ -29,7 +29,7 @@ module test1 { |
| 29 | type int32; | 29 | type int32; |
| 30 | } | 30 | } |
| 31 | container cont2 { | 31 | container cont2 { |
| 32 | - leaf leaf1 { | 32 | + leaf leaf3 { |
| 33 | type int32; | 33 | type int32; |
| 34 | } | 34 | } |
| 35 | } | 35 | } |
| ... | @@ -37,12 +37,12 @@ module test1 { | ... | @@ -37,12 +37,12 @@ module test1 { |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | augment /test2:cont1/test2:cont2/test2:cont3 { | 39 | augment /test2:cont1/test2:cont2/test2:cont3 { |
| 40 | - leaf a { | 40 | + leaf leaf2 { |
| 41 | type int32; | 41 | type int32; |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | container cont2 { | 44 | container cont2 { |
| 45 | - leaf leaf1 { | 45 | + leaf leaf4 { |
| 46 | type int32; | 46 | type int32; |
| 47 | } | 47 | } |
| 48 | } | 48 | } | ... | ... |
| ... | @@ -13,11 +13,11 @@ module test2 { | ... | @@ -13,11 +13,11 @@ module test2 { |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | container cont1 { | 15 | container cont1 { |
| 16 | - leaf leaf1 { | 16 | + leaf leaf5 { |
| 17 | type int32; | 17 | type int32; |
| 18 | } | 18 | } |
| 19 | container cont2 { | 19 | container cont2 { |
| 20 | - leaf leaf1 { | 20 | + leaf leaf6 { |
| 21 | type int32; | 21 | type int32; |
| 22 | } | 22 | } |
| 23 | } | 23 | } |
| ... | @@ -25,7 +25,7 @@ module test2 { | ... | @@ -25,7 +25,7 @@ module test2 { |
| 25 | 25 | ||
| 26 | augment /cont1/cont2 { | 26 | augment /cont1/cont2 { |
| 27 | container cont3 { | 27 | container cont3 { |
| 28 | - leaf a { | 28 | + leaf leaf7 { |
| 29 | type string; | 29 | type string; |
| 30 | } | 30 | } |
| 31 | } | 31 | } | ... | ... |
| ... | @@ -19,14 +19,14 @@ module test { | ... | @@ -19,14 +19,14 @@ module test { |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | augment /test2:cont1/test2:cont2/cont2 { | 21 | augment /test2:cont1/test2:cont2/cont2 { |
| 22 | - leaf a { | 22 | + leaf leaf { |
| 23 | type int32; | 23 | type int32; |
| 24 | } | 24 | } |
| 25 | uses group1; | 25 | uses group1; |
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | - augment /test2:cont1/test2:cont2/cont2/group1/cont1/cont2 { | 28 | + augment /test2:cont1/test2:cont2/cont2/cont1/cont2 { |
| 29 | - leaf a { | 29 | + leaf leaf1 { |
| 30 | type int32; | 30 | type int32; |
| 31 | } | 31 | } |
| 32 | } | 32 | } | ... | ... |
| ... | @@ -21,7 +21,7 @@ submodule test1 { | ... | @@ -21,7 +21,7 @@ submodule test1 { |
| 21 | grouping group1 { | 21 | grouping group1 { |
| 22 | container cont1 { | 22 | container cont1 { |
| 23 | container cont2 { | 23 | container cont2 { |
| 24 | - leaf a { | 24 | + leaf leaf2 { |
| 25 | type string; | 25 | type string; |
| 26 | } | 26 | } |
| 27 | } | 27 | } |
| ... | @@ -29,7 +29,7 @@ submodule test1 { | ... | @@ -29,7 +29,7 @@ submodule test1 { |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | augment /test2:cont1/test2:cont2 { | 31 | augment /test2:cont1/test2:cont2 { |
| 32 | - leaf a { | 32 | + leaf leaf3 { |
| 33 | type int32; | 33 | type int32; |
| 34 | } | 34 | } |
| 35 | container cont2 { | 35 | container cont2 { | ... | ... |
| ... | @@ -13,11 +13,11 @@ module test2 { | ... | @@ -13,11 +13,11 @@ module test2 { |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | container cont1 { | 15 | container cont1 { |
| 16 | - leaf leaf1 { | 16 | + leaf leaf4 { |
| 17 | type int32; | 17 | type int32; |
| 18 | } | 18 | } |
| 19 | container cont2 { | 19 | container cont2 { |
| 20 | - leaf leaf1 { | 20 | + leaf leaf5 { |
| 21 | type int32; | 21 | type int32; |
| 22 | } | 22 | } |
| 23 | } | 23 | } | ... | ... |
-
Please register or login to post a comment