yangtools.git
9 years agoMerge "BUG-865: fixed formatting of pom.xml"
Tony Tkacik [Thu, 3 Jul 2014 11:54:28 +0000 (11:54 +0000)]
Merge "BUG-865: fixed formatting of pom.xml"

9 years agoMerge "BUG-1143: binding-generator-impl: tests refactoring."
Tony Tkacik [Thu, 3 Jul 2014 11:52:17 +0000 (11:52 +0000)]
Merge "BUG-1143: binding-generator-impl: tests refactoring."

9 years agoMerge "BUG-1288: improve InstanceIdentifier API"
Tony Tkacik [Thu, 3 Jul 2014 11:08:52 +0000 (11:08 +0000)]
Merge "BUG-1288: improve InstanceIdentifier API"

9 years agoBUG-1288: improve InstanceIdentifier API 00/8600/1
Robert Varga [Thu, 3 Jul 2014 09:04:37 +0000 (11:04 +0200)]
BUG-1288: improve InstanceIdentifier API

Introduces getLastPathArgument and getReversePathArguments, which are
useful for some users, who open-code the equivalent methods.

Also removes the use of deprecated constructor, opting for an Iterables
utility class for intering instantiation.

Change-Id: I364e41dc7efdd1b3c56d03e626c8671b2c20ae8d
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-1275: optimize AugmentationSchemaProxy for lookup speed 62/8562/1
Robert Varga [Wed, 2 Jul 2014 16:42:18 +0000 (18:42 +0200)]
BUG-1275: optimize AugmentationSchemaProxy for lookup speed

This patch uses ImmutableMap to bias the map from creation speed to
lookup performance. Also, in the lookup path we perform a single lookup,
and check the null result, instead of contains() followed by a lookup.

Change-Id: Iba50dc5fae7ef87da79072be4936690587f46018
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-1275: do not copy arrays in XmlDocumentUtilsforEachChild() 44/8544/3
Robert Varga [Wed, 2 Jul 2014 10:58:22 +0000 (12:58 +0200)]
BUG-1275: do not copy arrays in XmlDocumentUtilsforEachChild()

ImmutableList.Builder() has a nasty habit of performing poorly for
anything that is larger than 2 elements. Let's elide it by following
smarts:

- check if the list of children is empty
- pre-allocate an arraylist, thus copying the array at most once

Change-Id: I08825e15fba92e256bd415c192d3f30d52d6d8eb
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-1275: speedup toPredicateValue() 43/8543/3
Robert Varga [Wed, 2 Jul 2014 10:12:45 +0000 (12:12 +0200)]
BUG-1275: speedup toPredicateValue()

Instead of performing startsWith/endsWith, we first check the first
character and based on that we optinally trim the string to the matching
character. Also fixes a bug, where string like 'abc" would be accepted.

Change-Id: I683074ec53a7924812d9fe77b669e7cab5f32ea8
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-1275: move InstanceIdentifierForXmlCodec 42/8542/3
Robert Varga [Wed, 2 Jul 2014 10:03:28 +0000 (12:03 +0200)]
BUG-1275: move InstanceIdentifierForXmlCodec

Move the class into the appropriate package and makes it a utility class
without an instance.

Change-Id: Ibaa03e5452fb4890815a11592e8a4787844c32f1
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-1275: optimize InstanceIdentifierForXmlCodec 41/8541/3
Robert Varga [Wed, 2 Jul 2014 08:38:21 +0000 (10:38 +0200)]
BUG-1275: optimize InstanceIdentifierForXmlCodec

First batch of optimizations:
- use Splitter instead of String.split()
- use characters instead of Strings
- use ThreadLocalRandom
- sue SchemaContext.findModuleByNamespace()

Various optimizations revolving around precompiling Patterns, using
characters instead of strings,

Change-Id: Id2befcc49d4346917a39d434b005b07fe3f50b7c
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-1275: optimized set instantiation ChoiceNodeBaseSerializer 40/8540/1
Robert Varga [Wed, 2 Jul 2014 11:42:19 +0000 (13:42 +0200)]
BUG-1275: optimized set instantiation ChoiceNodeBaseSerializer

The hashset used in getRealSchemasForAugment() can be initialized when
allocated, potentially saving some reallocation.

Change-Id: Ib848074716f5f4de108e6b348f0fed2f20bc6dcf
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-1275: use singletonLists 39/8539/1
Robert Varga [Wed, 2 Jul 2014 11:41:05 +0000 (13:41 +0200)]
BUG-1275: use singletonLists

There is no need to instantiate wasteful ArrayLists to hold a single
element -- use Collections.singletonList() for that.

Change-Id: I57c2149acdb8b44b245418cf0437e5f7f05a24ef
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-1275: optimize TypeDefinitionAwareCodec.normalizeHexadecimal() 38/8538/1
Robert Varga [Wed, 2 Jul 2014 10:26:02 +0000 (12:26 +0200)]
BUG-1275: optimize TypeDefinitionAwareCodec.normalizeHexadecimal()

normalizeHexadecimal() used non-optimal combination of searching for a
substring and a non-compiled regex replace. Optimize this by using
a precomputed CharMatcher instead.

Change-Id: Ie388735244c779d0e80ed98d8c6ce71bf2f4fbf6
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoOptimize BindingGeneratorUtil.parseToCamelCase() 37/8537/1
Robert Varga [Wed, 2 Jul 2014 11:17:41 +0000 (13:17 +0200)]
Optimize BindingGeneratorUtil.parseToCamelCase()

This replaces the relatively expensive replace operation with
CharMatcher.removeFrom().

Change-Id: I74123797427c76b3584394a3a203500bb9dea73b
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "BUG-868: do not use InstanceIdentifier constructor"
Martin Vitez [Wed, 2 Jul 2014 11:03:20 +0000 (11:03 +0000)]
Merge "BUG-868: do not use InstanceIdentifier constructor"

9 years agoBug 1131 - yang-parser-impl cleanup 89/8489/2
Tomas Olvecky [Tue, 1 Jul 2014 11:08:57 +0000 (13:08 +0200)]
Bug 1131 - yang-parser-impl cleanup

Fix small bugs (equals comparing incompatible types), null checks etc.
Fix import ordering.

Change-Id: I8c9f37e98542c63192ca8572edfd0de3643691cf
Signed-off-by: Tomas Olvecky <tolvecky@cisco.com>
9 years agoBUG-868: do not use InstanceIdentifier constructor 28/8528/1
Robert Varga [Wed, 2 Jul 2014 08:37:43 +0000 (10:37 +0200)]
BUG-868: do not use InstanceIdentifier constructor

Change-Id: Iffe519a5720d50c3ad6a88c747e36019507b6781
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "Improvements REST documentation generation"
Tony Tkacik [Wed, 2 Jul 2014 08:22:57 +0000 (08:22 +0000)]
Merge "Improvements REST documentation generation"

9 years agoBUG-1143: binding-generator-impl: tests refactoring. 01/8401/3
Martin Vitez [Fri, 27 Jun 2014 08:00:38 +0000 (10:00 +0200)]
BUG-1143: binding-generator-impl: tests refactoring.

Optimalized existing tests, removed useless test files.

Change-Id: I5dbe03b66b6d3251b87bc9eb1f1c89ebe6f03c3d
Signed-off-by: Martin Vitez <mvitez@cisco.com>
9 years agoMerge "RevisionIdentifier.getDefaultInstance() is static"
Martin Vitez [Wed, 2 Jul 2014 07:45:26 +0000 (07:45 +0000)]
Merge "RevisionIdentifier.getDefaultInstance() is static"

9 years agoMerge "Add serial version"
Martin Vitez [Wed, 2 Jul 2014 07:44:42 +0000 (07:44 +0000)]
Merge "Add serial version"

9 years agoBUG-865: fixed formatting of pom.xml 02/8502/4
Martin Vitez [Tue, 1 Jul 2014 14:29:40 +0000 (16:29 +0200)]
BUG-865: fixed formatting of pom.xml

Change-Id: I82a5a47f3c870ad8c51277abead71a0ae7281b40
Signed-off-by: Martin Vitez <mvitez@cisco.com>
9 years agoBug 762: Fixed accidental type change for union. 09/8509/3
Tony Tkacik [Tue, 1 Jul 2014 16:51:57 +0000 (18:51 +0200)]
Bug 762: Fixed accidental type change for union.

Previous patch used Java type derived from
subtypes from typedefinition, but most
of DOM code base were expecting string,
since in some cases it is hard to decide
between two subtypes.

Change-Id: I04355037047e742dc1e2a044dd7a5c48bc0dc0b7
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoMerge "Bug 762: Verify input in typedef codecs"
Tony Tkacik [Tue, 1 Jul 2014 14:51:27 +0000 (14:51 +0000)]
Merge "Bug 762: Verify input in typedef codecs"

9 years agoRevisionIdentifier.getDefaultInstance() is static 00/8500/2
Robert Varga [Tue, 1 Jul 2014 14:13:00 +0000 (16:13 +0200)]
RevisionIdentifier.getDefaultInstance() is static

This fixes warnings about static method being invoked on an instance,
plus it removes the now-unused instance.

Change-Id: I7c4594908d6b3a5c10e9b3f12e32ca203d3aa3d2
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoAdd serial version 99/8499/2
Robert Varga [Tue, 1 Jul 2014 14:12:16 +0000 (16:12 +0200)]
Add serial version

Exceptions are serializable, thus have to have serialVersionUUID.

Change-Id: I313174518bdc8fc358e6cdc5a7d2c42cac7add92
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "BUG-1258: Mark FIXME for implementation"
Tony Tkacik [Tue, 1 Jul 2014 14:49:41 +0000 (14:49 +0000)]
Merge "BUG-1258: Mark FIXME for implementation"

9 years agoMerge "BUG-868: do not use InstanceIdentifier.getPath()"
Tony Tkacik [Tue, 1 Jul 2014 14:48:49 +0000 (14:48 +0000)]
Merge "BUG-868: do not use InstanceIdentifier.getPath()"

9 years agoMerge "Cleanup pom.xml"
Tony Tkacik [Tue, 1 Jul 2014 14:48:35 +0000 (14:48 +0000)]
Merge "Cleanup pom.xml"

9 years agoMerge "BUG-994: introduce SchemaPath.getLastComponent()"
Tony Tkacik [Tue, 1 Jul 2014 14:47:04 +0000 (14:47 +0000)]
Merge "BUG-994: introduce SchemaPath.getLastComponent()"

9 years agoMerge "BUG-994: improve CopyUtils performance"
Tony Tkacik [Tue, 1 Jul 2014 14:46:49 +0000 (14:46 +0000)]
Merge "BUG-994: improve CopyUtils performance"

9 years agoMerge "BUG-994: use SchemaPath.getPathTowardRoot()"
Tony Tkacik [Tue, 1 Jul 2014 14:46:36 +0000 (14:46 +0000)]
Merge "BUG-994: use SchemaPath.getPathTowardRoot()"

9 years agoMerge "BUG-994: remove open-coded SchemaPath.createChild"
Tony Tkacik [Tue, 1 Jul 2014 14:46:24 +0000 (14:46 +0000)]
Merge "BUG-994: remove open-coded SchemaPath.createChild"

9 years agoBUG-1258: Mark FIXME for implementation 96/8496/2
Robert Varga [Mon, 30 Jun 2014 09:36:03 +0000 (11:36 +0200)]
BUG-1258: Mark FIXME for implementation

This is not a fix, but rather a marker for the place in code where we
have enough information to improve efficiency.

Change-Id: I26838baed3a8e0769fecd0e56c4e8a974fe6c971
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-868: do not use InstanceIdentifier.getPath() 49/8449/3
Robert Varga [Mon, 30 Jun 2014 09:19:45 +0000 (11:19 +0200)]
BUG-868: do not use InstanceIdentifier.getPath()

We only iterate through it, so we can use getPathArguments() instead.

Change-Id: I47a8655294c46ddd00626f72dae64218c6831753
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoCleanup pom.xml 97/8497/1
Robert Varga [Tue, 1 Jul 2014 14:08:37 +0000 (16:08 +0200)]
Cleanup pom.xml

This cleans up eclipse warnings about duplicate groupIds and overriding
versions.

Change-Id: Id920e7bb01814c5184f1157b093e3f449cfdf955
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-865: removed deprecated code from binding-java-api-generator tests. 01/8501/1
Martin Vitez [Tue, 1 Jul 2014 14:07:31 +0000 (16:07 +0200)]
BUG-865: removed deprecated code from binding-java-api-generator tests.

Fixed warning in ClassTemplate.xtend.

Change-Id: I4add39082ab10c8b8ddb6dc7c4062470b198e2f6
Signed-off-by: Martin Vitez <mvitez@cisco.com>
9 years agoBUG-994: introduce SchemaPath.getLastComponent() 08/8408/4
Robert Varga [Thu, 26 Jun 2014 18:59:02 +0000 (20:59 +0200)]
BUG-994: introduce SchemaPath.getLastComponent()

As it turns out we access the last component quite frequently. Let's
just expose it to the users, so they do not have to go through hoops to
find it.

Change-Id: I434f729f08196ad768e9326ffdc1cf9409ea8f07
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-994: improve CopyUtils performance 81/8381/5
Robert Varga [Thu, 26 Jun 2014 17:51:28 +0000 (19:51 +0200)]
BUG-994: improve CopyUtils performance

Instead of copying schemapath's components and juggling with them, use
the new utility functions to instantiate the paths more efficiently.

Change-Id: I86dca53150b46f25de8c5261c17332e9ee5d8533
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-994: use SchemaPath.getPathTowardRoot() 80/8380/5
Robert Varga [Thu, 26 Jun 2014 17:43:13 +0000 (19:43 +0200)]
BUG-994: use SchemaPath.getPathTowardRoot()

Instead of dereferencing the old API, use the new API, which gives the
same information more conveniently.

Change-Id: I485bae608bfb4aa1f6dae9838458a58ff4b23793
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-994: remove open-coded SchemaPath.createChild 79/8379/5
Robert Varga [Thu, 26 Jun 2014 16:58:30 +0000 (18:58 +0200)]
BUG-994: remove open-coded SchemaPath.createChild

This is just cleanup to use the common utility methods.

Change-Id: Icc0ed86e585ceb73c7f2f0a38da7525c40bd4303
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "Bug 1027: Decreased log level from INFO to DEBUG."
Martin Vitez [Tue, 1 Jul 2014 12:35:16 +0000 (12:35 +0000)]
Merge "Bug 1027: Decreased log level from INFO to DEBUG."

9 years agoBug 1198: Make URLSchemaContextResolver thread safe 14/8114/8
Tomas Olvecky [Wed, 18 Jun 2014 13:16:35 +0000 (15:16 +0200)]
Bug 1198: Make URLSchemaContextResolver thread safe

Make YangModelParser interface deprecated as recommended methods are in
YangContextParser.
yang-parser-impl - Introduce dependency on findbugs for documentation.
URLSchemaContextResolver - first round of refactoring, add
synchronized everywhere where data is changed.

Change-Id: Id53f165740301d085ad8374fc02897a0a19faa38
Signed-off-by: Tomas Olvecky <tolvecky@cisco.com>
9 years agoMerge "BUG 428 remove importing unnecessary imports"
Tony Tkacik [Tue, 1 Jul 2014 09:20:33 +0000 (09:20 +0000)]
Merge "BUG 428 remove importing unnecessary imports"

9 years agoImprovements REST documentation generation 82/8482/1
Ladislav Borak [Tue, 1 Jul 2014 08:27:58 +0000 (10:27 +0200)]
Improvements REST documentation generation

Signed-off-by: Ladislav Borak <lborak@cisco.com>
9 years agoMerge "Revert "Revert "BUG-994: reorganize SchemaPath into a tree"""
Tony Tkacik [Tue, 1 Jul 2014 08:06:53 +0000 (08:06 +0000)]
Merge "Revert "Revert "BUG-994: reorganize SchemaPath into a tree"""

9 years agoMerge "BUG-994: do not use SchemaPath.getPath()"
Robert Varga [Mon, 30 Jun 2014 19:33:26 +0000 (19:33 +0000)]
Merge "BUG-994: do not use SchemaPath.getPath()"

9 years agoBug 1027: Decreased log level from INFO to DEBUG. 56/8456/1
Tony Tkacik [Mon, 30 Jun 2014 12:57:28 +0000 (14:57 +0200)]
Bug 1027: Decreased log level from INFO to DEBUG.

Change-Id: I79452e344c23aa593505ac41337c9d9306b6f1d5
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoBUG 428 remove importing unnecessary imports 48/5448/18
Jozef Gloncak [Mon, 28 Apr 2014 11:41:40 +0000 (13:41 +0200)]
BUG 428 remove importing unnecessary imports

List of imports is created from all GeneratedTypes which were used while
generating interface or class.

Fully qualified name is always used for classes which belongs to
java.lang.* package

Change-Id: I14dcf1bd852ef596c6001c5bf2ffeac9a65d962b
Signed-off-by: Jozef Gloncak <jgloncak@cisco.com>
9 years agoBUG 1131: Introduced sealing of builder, initial clean up of ModuleBuilder. 98/7898/11
Tomas Olvecky [Tue, 24 Jun 2014 11:09:12 +0000 (13:09 +0200)]
BUG 1131: Introduced sealing of builder, initial clean up of ModuleBuilder.

Introduced sealing of builders, which makes sure builder is not
modified once the product of build was created.

Logic in parser prevented this already, but it was external
check to builders, not internal.

Sealing of builders is critical for implementing safe
instantiation since once you create copy of builder
(eg.instantiation of grouping) you do NOT want
to have grouping definition accidentally change.

This should prevent introducing regressions as described above.

Change-Id: Iad2dfc8036d27f3538e48315eb1fc17a5481f67b
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
Signed-off-by: Tomas Olvecky <tolvecky@cisco.com>
9 years agoBUG 1131: Removed duplicate code in builders. 95/7895/13
Tomas Olvecky [Wed, 25 Jun 2014 12:22:30 +0000 (14:22 +0200)]
BUG 1131: Removed duplicate code in builders.

Sonar Analysis showed that concrete implementations of builders have
number of similar code blocks, which deals with creating instance
of schema node.

This functionality should have only one implementiation (this
increases readibility and reduces potential places for bugs)
moved common shared functionality  to Abstract*Builder and
Abstract implementaitons of SchemaNodes.

Change-Id: Ie9d87eaa728612090f9ad3740381df1bf970d1fe
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
Signed-off-by: Tomas Olvecky <tolvecky@cisco.com>
9 years agoRevert "Revert "BUG-994: reorganize SchemaPath into a tree"" 07/8407/2
Robert Varga [Fri, 27 Jun 2014 12:46:08 +0000 (14:46 +0200)]
Revert "Revert "BUG-994: reorganize SchemaPath into a tree""

This reverts commit 65f3c40b20bd437268a3ebc83afe23aa07f80eaf.

Change-Id: I4540def627dcafbb39afa17a8e4ff076622d347c
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "BUG 1250 - leaf of type empty can't saved via restconf"
Tony Tkacik [Mon, 30 Jun 2014 08:13:11 +0000 (08:13 +0000)]
Merge "BUG 1250 - leaf of type empty can't saved via restconf"

9 years agoBUG-994: do not use SchemaPath.getPath() 47/8447/2
Martin Vitez [Mon, 30 Jun 2014 06:57:35 +0000 (08:57 +0200)]
BUG-994: do not use SchemaPath.getPath()

Change-Id: If513126e831b6d1d8039fa2d3d1e298bd9fd411e
Signed-off-by: Martin Vitez <mvitez@cisco.com>
9 years agofeature-yangtool breaks release 71/8371/2
Giovanni Meo [Thu, 26 Jun 2014 14:00:41 +0000 (16:00 +0200)]
feature-yangtool breaks release

- feature-yangtool need to depend on all the bundles that are listed
as being part of the feature file else the maven reaction may try to
include files in the feature that are not yet been built and cannot be
fetched otherwise. Typical case of this is when you have releases
- Some pom cleanup warning

Change-Id: I27269e3cc88cea8d285fa421387869ea89ef67a5
Signed-off-by: Giovanni Meo <gmeo@cisco.com>
9 years agoBug 762: Verify input in typedef codecs 67/7367/11
tpantelis [Tue, 27 May 2014 17:07:42 +0000 (13:07 -0400)]
Bug 762: Verify input in typedef codecs

- Modified the Bits, Union, Enum, and Empty TypeDefinitionAwareCodecs to
  verify
  the input in the deserialize method and throw IllegalArgEx if invalid.
- Modified IdentityCompositeCodec to throw IllegalArgEx if input not
  found in identity map.
- Added unit tests to cover all the TypeDefinitionAwareCodec-derived
  classes.

Change-Id: I10e963b83bfb9e4200f3ea0e77cd41bd48d04474
Signed-off-by: tpantelis <tpanteli@brocade.com>
9 years agoBUG 1250 - leaf of type empty can't saved via restconf 02/8402/1
Jozef Gloncak [Fri, 27 Jun 2014 09:25:05 +0000 (11:25 +0200)]
BUG 1250 - leaf of type empty can't saved via restconf

Check where value of leaf has to be different from null was removed.

Signed-off-by: Jozef Gloncak <jgloncak@cisco.com>
9 years agoMerge "Revert "BUG-994: reorganize SchemaPath into a tree""
Jan Medved [Fri, 27 Jun 2014 00:14:36 +0000 (00:14 +0000)]
Merge "Revert "BUG-994: reorganize SchemaPath into a tree""

9 years agoRevert "BUG-994: reorganize SchemaPath into a tree" 90/8390/1
Ed Warnicke [Thu, 26 Jun 2014 23:59:15 +0000 (23:59 +0000)]
Revert "BUG-994: reorganize SchemaPath into a tree"

This reverts commit 1ef3b93dd9e9095eb4eb3d1ac7c595f52f779686.

Change-Id: Iee2e0b57b2cb8bf8e193a443030ec42ddfa238ae
Signed-off-by: Ed Warnicke <eaw@cisco.com>
9 years agoMerge "BUG-1201: make yangtools compilable with java 8."
Tony Tkacik [Thu, 26 Jun 2014 13:46:20 +0000 (13:46 +0000)]
Merge "BUG-1201: make yangtools compilable with java 8."

9 years agoMerge "BUG-994: reorganize SchemaPath into a tree"
Tony Tkacik [Thu, 26 Jun 2014 13:39:23 +0000 (13:39 +0000)]
Merge "BUG-994: reorganize SchemaPath into a tree"

9 years agoMerge "BUG-994: optimize resolveRelativeXPath()"
Tony Tkacik [Thu, 26 Jun 2014 13:37:51 +0000 (13:37 +0000)]
Merge "BUG-994: optimize resolveRelativeXPath()"

9 years agoMerge "BUG-944: convert SchemaContextUtil to use Iterable"
Tony Tkacik [Thu, 26 Jun 2014 13:37:29 +0000 (13:37 +0000)]
Merge "BUG-944: convert SchemaContextUtil to use Iterable"

9 years agoMerge "BUG-944: optimize SchemaContextUtil"
Tony Tkacik [Thu, 26 Jun 2014 13:36:28 +0000 (13:36 +0000)]
Merge "BUG-944: optimize SchemaContextUtil"

9 years agoMerge "BUG-994: do not use SchemaPath.getPath()"
Tony Tkacik [Thu, 26 Jun 2014 13:35:57 +0000 (13:35 +0000)]
Merge "BUG-994: do not use SchemaPath.getPath()"

9 years agoFixed leak of LazyGeneratedCodecRegistry between restarts of service. 68/8368/1
Tony Tkacik [Thu, 26 Jun 2014 12:15:05 +0000 (14:15 +0200)]
Fixed leak of LazyGeneratedCodecRegistry between restarts of service.

LocationAwareDispatch codecs was inner classes referencing
their parent and between tests leaked incorrect order context.
Updated their implementation, to take latest LazyGeneratedCodecRegistry.

This still assumes there is only one registry at a time
per classloader space.

Change-Id: I1ae58e1c4dd90914893e61172b6d171b458d2ba2
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoBUG-994: reorganize SchemaPath into a tree 37/8337/6
Robert Varga [Wed, 25 Jun 2014 07:18:56 +0000 (09:18 +0200)]
BUG-994: reorganize SchemaPath into a tree

Instead of storing the entire path in the scemapath object, this patch
reworks the class such that it holds 0ne component of the path and a
reference to the parent path.

Change-Id: Ic029c84db9817f9799070c5c4aad7fc3f5fa13b1
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-994: optimize resolveRelativeXPath() 36/8336/4
Robert Varga [Wed, 25 Jun 2014 13:41:12 +0000 (15:41 +0200)]
BUG-994: optimize resolveRelativeXPath()

This patch is a slight optimization of the method which takes advantage
of the fact that we do not need to return a List anymore.

Change-Id: I05ed7b96feca26247a6d73dfe2e758846155302f
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-944: convert SchemaContextUtil to use Iterable 35/8335/4
Robert Varga [Wed, 25 Jun 2014 11:09:14 +0000 (13:09 +0200)]
BUG-944: convert SchemaContextUtil to use Iterable

SchemaContextUtil is heavily centered around the idea that a SchemaPath
has a List of QName. That assumption is deprecated, so convert this
class to use Iterable instead, preparing it for transition to new APIs.

Change-Id: I0e23bd534c441d19aab62eb7a3069244b27532b2
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-944: optimize SchemaContextUtil 34/8334/4
Robert Varga [Wed, 25 Jun 2014 10:52:08 +0000 (12:52 +0200)]
BUG-944: optimize SchemaContextUtil

SchemaContextUtil used String.split(), which is extremely costly to
execute. This patch converts it to use Splitters instead and
opportunistically optimizes resolveRelativeXPath().

Change-Id: Ib270361d7aead90d3fcdeb3b865c5327a298b20d
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-994: do not use SchemaPath.getPath() 33/8333/3
Robert Varga [Wed, 25 Jun 2014 11:20:19 +0000 (13:20 +0200)]
BUG-994: do not use SchemaPath.getPath()

SchemaContextUtil used getPath() to construct parent from the path --
use getParent() instead. Furthermore convert uses where it is only used
as Iterable into getPathFromRoot().

Change-Id: I455e9e297c4ed6a7f861bb6cc9b6e4ece2bd8337
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "BUG-994: make SchemaPath abstract"
Tony Tkacik [Wed, 25 Jun 2014 13:16:05 +0000 (13:16 +0000)]
Merge "BUG-994: make SchemaPath abstract"

9 years agoMerge "BUG-994: remove the legacy public constructor"
Tony Tkacik [Wed, 25 Jun 2014 13:15:44 +0000 (13:15 +0000)]
Merge "BUG-994: remove the legacy public constructor"

9 years agoMerge "BUG-865: do not use SchemaPath.getPath()"
Tony Tkacik [Wed, 25 Jun 2014 13:14:26 +0000 (13:14 +0000)]
Merge "BUG-865: do not use SchemaPath.getPath()"

9 years agoMerge "BUG-994: Use SchemaPath.getParent()"
Tony Tkacik [Wed, 25 Jun 2014 13:13:41 +0000 (13:13 +0000)]
Merge "BUG-994: Use SchemaPath.getParent()"

9 years agoMerge "BUG-994: introduce SchemaPath.getParent()"
Tony Tkacik [Wed, 25 Jun 2014 13:13:23 +0000 (13:13 +0000)]
Merge "BUG-994: introduce SchemaPath.getParent()"

9 years agoMerge "Bug 1203: Reset state of LocationDispatchCodecs"
Martin Vitez [Wed, 25 Jun 2014 10:03:32 +0000 (10:03 +0000)]
Merge "Bug 1203: Reset state of LocationDispatchCodecs"

9 years agoMerge "Move implementation of DataTree to Yangtools"
Tony Tkacik [Wed, 25 Jun 2014 09:39:27 +0000 (09:39 +0000)]
Merge "Move implementation of DataTree to Yangtools"

9 years agoBUG-994: make SchemaPath abstract 88/8288/3
Robert Varga [Tue, 24 Jun 2014 08:09:44 +0000 (10:09 +0200)]
BUG-994: make SchemaPath abstract

Now that the direct instantiations have been eradicated, make SchemaPath
an abstract class. Introduce RelativeSchemaPath and AbstractSchemaPath
to hold the two distinct types, eliminating the need for a boolean
field.

Change-Id: Icad3e23ac15f9238ed4c44dc77718fb43a0a9f4f
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-994: remove the legacy public constructor 86/8286/3
Robert Varga [Tue, 24 Jun 2014 07:36:11 +0000 (09:36 +0200)]
BUG-994: remove the legacy public constructor

This removes the constructor, so SchemaPaths are impossible to create
directly, allowing us to evolve and optimize the class further.

Change-Id: Id8ced3d26f012be98504aa1c44ebe1d732b288ba
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-865: do not use SchemaPath.getPath() 87/8287/3
Robert Varga [Tue, 24 Jun 2014 07:44:24 +0000 (09:44 +0200)]
BUG-865: do not use SchemaPath.getPath()

Gets rid of use of SchemaPath.getPath(). Also performs some drive-by
optimizations:
- use a static instance of Joiner
- use Iterables.transform() for creating path String

Change-Id: Ib5bd63a9de6c05482f0cf677f634a279f4cedcbd
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMove implementation of DataTree to Yangtools 68/8268/5
Basheeruddin Ahmed [Mon, 23 Jun 2014 23:09:08 +0000 (16:09 -0700)]
Move implementation of DataTree to Yangtools

Analysis showed that implementation of DataTree
in MD-SAL Data Store, is generic and can
be used outside of Data Store as part of
YANG Data component. This patch
moves existing code created by
 - Robert Varga <rovargs@cisco.com>
 - Tony Tkacik <ttkacik@cisco.com>

To new location

yang-data-api - Data structure & data tree API definitions
yang-data-impl - Data structures and data tree logic

Change-Id: I0a93714677b5315534630d942e35e0262fa8d41d
Signed-off-by: Basheeruddin Ahmed <syedbahm@cisco.com>
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-994: Use SchemaPath.getParent() 85/8285/2
Robert Varga [Tue, 24 Jun 2014 07:35:00 +0000 (09:35 +0200)]
BUG-994: Use SchemaPath.getParent()

Now that SchemaPath defines the proper utility method, use it instead of
brewing our own.

Change-Id: If3661c78491ab97e70627dfffcd902a21bd93e83
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBug 1203: Reset state of LocationDispatchCodecs 16/8116/4
Tony Tkacik [Wed, 18 Jun 2014 14:09:09 +0000 (16:09 +0200)]
Bug 1203: Reset state of LocationDispatchCodecs

LocationDispatchCodecs must react to schema
context change, which may introduce changes
of locations, in which they are used.

This actually requires reinitialization of these
codecs (cases, augmentations) in order to discover
newly introduced case classes or augmentation classes
or to disable unload ones.

Initialization of codecs is done lazily and uses
same code-path as their first use.

Change-Id: I621edcfbe4bd29612e3358aa2e507b14e3002524
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoBUG-1201: make yangtools compilable with java 8. 06/8106/2
Robert Varga [Wed, 18 Jun 2014 09:59:40 +0000 (11:59 +0200)]
BUG-1201: make yangtools compilable with java 8.

Changed collection sorting in xtend classes.
Added maven profile to parent pom which is activated in java 8 environment to turn off DocLint.

Change-Id: Ief9dbaf9e029e653e337bf86740cdad0d07734f3
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-994: introduce SchemaPath.getParent() 84/8284/1
Robert Varga [Tue, 24 Jun 2014 07:32:47 +0000 (09:32 +0200)]
BUG-994: introduce SchemaPath.getParent()

There are a few places which manually construct the parent of a
SchemaPath. Introduce a utility method which does precisely that in the
most efficient manner possible.

Change-Id: If144ddf3bb50f7bc25865c342ec9099045aafb93
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "Checkstyle maven plugin check - yangtools"
Tony Tkacik [Tue, 24 Jun 2014 07:23:42 +0000 (07:23 +0000)]
Merge "Checkstyle maven plugin check - yangtools"

9 years agoMerge "BUG-579: removed dependency on GeneratedTOBuilderImpl from Types to break...
Tony Tkacik [Tue, 24 Jun 2014 07:21:09 +0000 (07:21 +0000)]
Merge "BUG-579: removed dependency on GeneratedTOBuilderImpl from Types to break a package cycle."

9 years agoCheckstyle maven plugin check - yangtools 21/7721/5
Milos Fabian [Wed, 4 Jun 2014 14:56:43 +0000 (16:56 +0200)]
Checkstyle maven plugin check - yangtools

    -violations do not fail build
    -rules defined in yangtools/common/checkstyle-logging
https://git.opendaylight.org/gerrit/#/c/7595/
https://git.opendaylight.org/gerrit/#/c/7108/

Change-Id: I26bfa119f3484444fe33d47640db7407f9a3cd55
Signed-off-by: Milos Fabian <milfabia@cisco.com>
9 years agoBUG-582: formattedRevision is lazy 78/8278/1
Robert Varga [Tue, 24 Jun 2014 05:54:55 +0000 (07:54 +0200)]
BUG-582: formattedRevision is lazy

This patch creates formattedRevision lazily to prevent unneeded string
explosions.

Change-Id: I15c1270e0c2ab3d90e176046a87efc65f9ba7c03
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-582: Use QNameModule for hashCode/equals 77/8277/1
Robert Varga [Mon, 19 May 2014 05:47:03 +0000 (07:47 +0200)]
BUG-582: Use QNameModule for hashCode/equals

Updates QName to use use QNameModule's hashCode/equals.

Change-Id: I823faa4a2061bbe952560ce3fb2df42facf6a746
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "Extract typedefs to local variable to avoid error in xtend generated class."
Tony Tkacik [Mon, 23 Jun 2014 16:16:52 +0000 (16:16 +0000)]
Merge "Extract typedefs to local variable to avoid error in xtend generated class."

9 years agoBUG-579: removed dependency on GeneratedTOBuilderImpl from Types to break a package... 31/7931/2
Martin Vitez [Thu, 12 Jun 2014 07:21:58 +0000 (09:21 +0200)]
BUG-579: removed dependency on GeneratedTOBuilderImpl from Types to break a package cycle.

Signed-off-by: Martin Vitez <mvitez@cisco.com>
9 years agoExtract typedefs to local variable to avoid error in xtend generated class. 98/7398/3
Martin Vitez [Mon, 26 May 2014 12:14:42 +0000 (14:14 +0200)]
Extract typedefs to local variable to avoid error in xtend generated class.

Change-Id: If58153836a3e619be51f5eeedce44e9f92076f47
Signed-off-by: Martin Vitez <mvitez@cisco.com>
9 years agoBUG-582: improve SchemaPath.hashCode() 66/7766/14
Robert Varga [Thu, 5 Jun 2014 21:51:26 +0000 (23:51 +0200)]
BUG-582: improve SchemaPath.hashCode()

SchemaPath.hashCode() is currently the hottest hashCode of immutable
objects. SchemaPath has similar uses as the BA InstanceIdentifier, where
we use hash code caching.

This patch introduces such caching. It also prevents list duplication
when we do not need to copy the entire list.

Change-Id: I5a8fe845ebb50308fde7fc766970f81ea706c203
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-582: optimize TypeProviderImpl 57/8157/3
Robert Varga [Thu, 19 Jun 2014 18:00:01 +0000 (20:00 +0200)]
BUG-582: optimize TypeProviderImpl

This just replaces obvious string misuses with more-performant
replacements.

Change-Id: Ib8fe7a3a40e3fe9fa78d3eec2f83c1341040a937
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG 1131: untangling package cyclic dependencies in yang-parser-impl 66/7866/10
Tony Tkacik [Wed, 4 Jun 2014 13:54:22 +0000 (15:54 +0200)]
BUG 1131: untangling package cyclic dependencies in yang-parser-impl

This untanglement of package cyclic dependencies introduced
better code organization, when more-obvious components
logical blocks are available, most of moved classes
were private to parser and was never meant for public consumption.

  - yang.model.util - Utility and simple implementations of yang-model-api
  - yang.parser.builder.* - Builders for yang-model-api with
semantic functionality
  - yang.parser.impl - Actual implementation of YANG Parser
  - yang.parser.impl.util - Utility functions on top of YANG Parser
  - yang.parser.util - Utility classes, potential candidates for movements.

Change-Id: Ia5718f4712d91df7cea0f55d4cc1a502d376faea
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "BUG-582: pre-cache Pattern instances"
Tony Tkacik [Fri, 20 Jun 2014 14:15:05 +0000 (14:15 +0000)]
Merge "BUG-582: pre-cache Pattern instances"

9 years agoMerge "Introduce HashCodeBuilder"
Tony Tkacik [Fri, 20 Jun 2014 14:14:54 +0000 (14:14 +0000)]
Merge "Introduce HashCodeBuilder"

9 years agoBUG-944 Fix HostBuilder class conflict for domain/ipv4 address 71/8171/3
Maros Marsalek [Fri, 20 Jun 2014 11:11:33 +0000 (13:11 +0200)]
BUG-944 Fix HostBuilder class conflict for domain/ipv4 address

Ipv4 addresses were matched by ipv4 as well as domain-name pattern in HostBuilder class, which caused a conflict.

Now ipv4 pattern is prefered to domain-name.

Change-Id: Ia449d247c04747d6ca50856f92d3aa77b581e60f
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
9 years agoBUG-582: pre-cache Pattern instances 21/7821/3
Robert Varga [Sun, 8 Jun 2014 20:41:12 +0000 (22:41 +0200)]
BUG-582: pre-cache Pattern instances

In a few places we did not cache the regex patters we used, resulting in
sub-optimal performance. This patch corrects that, moving them as close
to being static as possible.

Change-Id: I5edb8c1f33dff9178a0101fbb8fa71a6a3237aab
Signed-off-by: Robert Varga <rovarga@cisco.com>