mdsal.git
9 years agoOutput generated codec source to files
tpantelis [Sat, 10 May 2014 16:04:46 +0000 (12:04 -0400)]
Output generated codec source to files

- Added SourceCodeGenerator helper class that holds the generated
  field/method source code until outputGeneratedSource is called to
  generate the source for the entire class and output to a file
  under generated-sources.

- Modified TransformerGenerator and JavassistUtils to use the
  SourceCodeGenerator.

- Other pom changes to eliminate Eclipse errors.

Change-Id: Id910161569835d0cf9659ddf806e21f2545c713b
Signed-off-by: tpantelis <tpanteli@brocade.com>
9 years agoBUG-1270: be smart about Restrictions
Robert Varga [Tue, 15 Jul 2014 21:04:23 +0000 (23:04 +0200)]
BUG-1270: be smart about Restrictions

Restrictions are based on type definitions, which are constant. For base
types they always are. For extended types, they are usually empty.
Optimize memory usage by reusing the lists anchored in types and also by
having a singleton instance for the all-empty case.

Change-Id: Ie9773d7efb57d403a008b82716eb22d97fefb224
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "Bug 865: Fixed incorrect conversion to new APIs."
Tony Tkacik [Tue, 15 Jul 2014 11:20:38 +0000 (11:20 +0000)]
Merge "Bug 865: Fixed incorrect conversion to new APIs."

9 years agoBug 865: Fixed incorrect conversion to new APIs.
Tony Tkacik [Tue, 15 Jul 2014 10:42:37 +0000 (12:42 +0200)]
Bug 865: Fixed incorrect conversion to new APIs.

Change-Id: I585e4d9142dc261317661c4442c771db791a46de
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoMerge "BUG-1347: fixed bug in generation constraints for decimal64 type."
Tony Tkacik [Tue, 15 Jul 2014 09:46:17 +0000 (09:46 +0000)]
Merge "BUG-1347: fixed bug in generation constraints for decimal64 type."

9 years agoMerge "Bug 865: Removed uses of packageNameFromModule"
Martin Vitez [Tue, 15 Jul 2014 09:37:35 +0000 (09:37 +0000)]
Merge "Bug 865: Removed uses of packageNameFromModule"

9 years agoMerge "Bug 1366: Fallback scenario for IdentityCodec to work without schema."
Martin Vitez [Tue, 15 Jul 2014 09:36:49 +0000 (09:36 +0000)]
Merge "Bug 1366: Fallback scenario for IdentityCodec to work without schema."

9 years agoMerge "API Cleanup: Moved package name computation to BindingMapping."
Martin Vitez [Tue, 15 Jul 2014 09:35:37 +0000 (09:35 +0000)]
Merge "API Cleanup: Moved package name computation to BindingMapping."

9 years agoBug 865: Removed uses of packageNameFromModule
Tony Tkacik [Tue, 15 Jul 2014 09:14:52 +0000 (11:14 +0200)]
Bug 865: Removed uses of packageNameFromModule

Change-Id: I49d16e69943777acb34ac904ce2559302d0ac39c
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoBug 1366: Fallback scenario for IdentityCodec to work without schema.
Tony Tkacik [Tue, 15 Jul 2014 09:10:33 +0000 (11:10 +0200)]
Bug 1366: Fallback scenario for IdentityCodec to work without schema.

Change-Id: Ife4c3c15db1397829c5b5a46575785121bf41ed1
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoAPI Cleanup: Moved package name computation to BindingMapping.
Tony Tkacik [Tue, 15 Jul 2014 09:02:39 +0000 (11:02 +0200)]
API Cleanup: Moved package name computation to BindingMapping.

Change-Id: I8e9016c4cadd7bee36ec440b960891503b645f4a
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoBUG-1347: fixed bug in generation constraints for decimal64 type.
Martin Vitez [Thu, 10 Jul 2014 13:51:32 +0000 (15:51 +0200)]
BUG-1347: fixed bug in generation constraints for decimal64 type.

Added test.

Change-Id: I52a539ea7c5ff6b36b9bc362660188f9627bff7d
Signed-off-by: Martin Vitez <mvitez@cisco.com>
9 years agoMerge "Bug 1339: Decreased anyxml warning to debug."
Tony Tkacik [Wed, 9 Jul 2014 10:38:13 +0000 (10:38 +0000)]
Merge "Bug 1339: Decreased anyxml warning to debug."

9 years agoBug 1339: Decreased anyxml warning to debug.
Tony Tkacik [Wed, 9 Jul 2014 07:25:33 +0000 (09:25 +0200)]
Bug 1339: Decreased anyxml warning to debug.

Change-Id: I9f21f1fd181229a6b3dccd7aa7dc9c53ab4e5db0
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoMerge "BUG-1304: rework BindingGeneratorImpl from xtend to java"
Tony Tkacik [Tue, 8 Jul 2014 16:46:31 +0000 (16:46 +0000)]
Merge "BUG-1304: rework BindingGeneratorImpl from xtend to java"

9 years agoBUG-1304: rework BindingGeneratorImpl from xtend to java
Martin Vitez [Fri, 4 Jul 2014 13:22:02 +0000 (15:22 +0200)]
BUG-1304: rework BindingGeneratorImpl from xtend to java

Change-Id: Idc09bca749951fb8c075b9ffb291c2a6a362dbe2
Signed-off-by: Martin Vitez <mvitez@cisco.com>
10 years agoMerge "Bug 560: Fixed incoherent API implementation."
Tony Tkacik [Fri, 4 Jul 2014 08:04:38 +0000 (08:04 +0000)]
Merge "Bug 560: Fixed incoherent API implementation."

10 years agoBUG-579: Remove the dependency on GeneratedTOBuilderImpl to break a package cycle.
Martin Vitez [Fri, 4 Jul 2014 07:31:01 +0000 (09:31 +0200)]
BUG-579: Remove the dependency on GeneratedTOBuilderImpl to break a package cycle.

Change-Id: Ibcdd7bcb0cdf44d5d7ef30105624bede15bcd50e
Signed-off-by: Martin Vitez <mvitez@cisco.com>
10 years agoUse CharMatcher in packageNameForGeneratedType()
Robert Varga [Thu, 3 Jul 2014 21:43:03 +0000 (23:43 +0200)]
Use CharMatcher in packageNameForGeneratedType()

Instead of performing up to two string copies, use a single replacement
pass, taking into account two characters using a CharMatcher.

Change-Id: I305d384eff2da5d0bfb3b1b820270f4480a800a4
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoOptimize BindingMapping.toCamelCase()
Robert Varga [Thu, 3 Jul 2014 21:38:47 +0000 (23:38 +0200)]
Optimize BindingMapping.toCamelCase()

Instead of replacing characters, we use a CharMatcher in the Splitter.
This elides the need to copy strings and search them multiple times.

Change-Id: Iff0e580f927a5f983a3eb6e2e3b318f33a1b2217
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoBug 560: Fixed incoherent API implementation.
Lukas Sedlak [Fri, 4 Jul 2014 06:41:30 +0000 (08:41 +0200)]
Bug 560: Fixed incoherent API implementation.

Fixed bug in getRpcServiceClassFor method. Now method follows API contract and will return class
for specified module namespace and module revision.

Signed-off-by: Lukas Sedlak <lsedlak@cisco.com>
10 years agoDo not use "".equals(String)
Robert Varga [Thu, 3 Jul 2014 21:17:59 +0000 (23:17 +0200)]
Do not use "".equals(String)

This is an ugly shorthand for String.isEmpty(), so let's not use it.

Change-Id: I6f00cc0676f982e99690294a11e703832b404977
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoMerge "BUG-1119: optimize length and range checks in generated sources."
Tony Tkacik [Thu, 3 Jul 2014 11:59:46 +0000 (11:59 +0000)]
Merge "BUG-1119: optimize length and range checks in generated sources."

10 years agoMerge "BUG-597: removed dependency on GeneratedTOBuilderImpl from BindingGeneratorUti...
Tony Tkacik [Thu, 3 Jul 2014 11:55:58 +0000 (11:55 +0000)]
Merge "BUG-597: removed dependency on GeneratedTOBuilderImpl from BindingGeneratorUtil to break a package cycle."

10 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."

10 years agoBUG-1275: do not copy arrays in XmlDocumentUtilsforEachChild()
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>
10 years agoOptimize BindingGeneratorUtil.parseToCamelCase()
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>
10 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"

10 years agoBUG-868: do not use InstanceIdentifier constructor
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>
10 years agoMerge "Improvements REST documentation generation"
Tony Tkacik [Wed, 2 Jul 2014 08:22:57 +0000 (08:22 +0000)]
Merge "Improvements REST documentation generation"

10 years agoBUG-597: removed dependency on GeneratedTOBuilderImpl from BindingGeneratorUtil to...
Martin Vitez [Thu, 12 Jun 2014 10:46:14 +0000 (12:46 +0200)]
BUG-597: removed dependency on GeneratedTOBuilderImpl from BindingGeneratorUtil to break a package cycle.

Change-Id: I6dfbf217982e1128ab22db70af261ade250642c3
Signed-off-by: Martin Vitez <mvitez@cisco.com>
10 years agoBUG-1119: optimize length and range checks in generated sources.
Martin Vitez [Tue, 10 Jun 2014 13:40:43 +0000 (15:40 +0200)]
BUG-1119: optimize length and range checks in generated sources.

Constraints are generated only once (by double-checked locking) and stored as immutable static variable.
BigInteger and BigDecimal values 0, 1 and 10 are represented as Big*.ZERO, ONE or TEN.
BigInteger values are created via BigInteger.valueOf(long) call.

Change-Id: Idb54d841fe64fd5a32af38b30126a314d6bc7a0d
Signed-off-by: Martin Vitez <mvitez@cisco.com>
10 years agoBUG-1143: binding-generator-impl: tests refactoring.
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>
10 years agoMerge "RevisionIdentifier.getDefaultInstance() is static"
Martin Vitez [Wed, 2 Jul 2014 07:45:26 +0000 (07:45 +0000)]
Merge "RevisionIdentifier.getDefaultInstance() is static"

10 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"

10 years agoRevisionIdentifier.getDefaultInstance() is static
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>
10 years agoMerge "Cleanup pom.xml"
Tony Tkacik [Tue, 1 Jul 2014 14:48:35 +0000 (14:48 +0000)]
Merge "Cleanup pom.xml"

10 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()"

10 years agoCleanup pom.xml
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>
10 years agoBUG-865: removed deprecated code from binding-java-api-generator tests.
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>
10 years agoBUG-994: use SchemaPath.getPathTowardRoot()
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>
10 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."

10 years agoBug 1198: Make URLSchemaContextResolver thread safe
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>
10 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"

10 years agoImprovements REST documentation generation
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>
10 years agoBug 1027: Decreased log level from INFO to DEBUG.
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>
10 years agoBUG 428 remove importing unnecessary imports
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>
10 years agoBug 762: Verify input in typedef codecs
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>
10 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."

10 years agoFixed leak of LazyGeneratedCodecRegistry between restarts of service.
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>
10 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"

10 years agoBug 1203: Reset state of LocationDispatchCodecs
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>
10 years agoBUG-1201: make yangtools compilable with java 8.
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>
10 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"

10 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."

10 years agoCheckstyle maven plugin check - yangtools
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>
10 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."

10 years agoBUG-579: removed dependency on GeneratedTOBuilderImpl from Types to break a package...
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>
10 years agoExtract typedefs to local variable to avoid error in xtend generated class.
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>
10 years agoBUG-582: optimize TypeProviderImpl
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>
10 years agoBUG 1131: untangling package cyclic dependencies in yang-parser-impl
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>
10 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"

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

10 years agoBUG-944 Fix HostBuilder class conflict for domain/ipv4 address
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>
10 years agoBUG-582: pre-cache Pattern instances
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>
10 years agoIntroduce HashCodeBuilder
Robert Varga [Sat, 7 Jun 2014 20:13:00 +0000 (22:13 +0200)]
Introduce HashCodeBuilder

This patch moves HashCodeBuilder, and internal yang-binding utility
class, into the util package and make it public.

The class was originally used to incrementally create InstanceIdentifier
hash code. As it turns out, we have at least two other potential users,
who could benefit from that same pattern: SchemaPath and the data-api
InstanceIdentifier, since they really are just different views on the
same concept.

Change-Id: I6a3208de213a47a2ed98e64f73a883dca73034fc
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoBUG-1195: made typedef classes serializable.
Martin Vitez [Wed, 18 Jun 2014 16:08:07 +0000 (18:08 +0200)]
BUG-1195: made typedef classes serializable.

All classes generated from yang typedef statement now implement java.io.Serializable and contain serialVersionUID property.

Signed-off-by: Martin Vitez <mvitez@cisco.com>
10 years agoMerge "BUG-582: optimize replaceWithCamelCase"
Tony Tkacik [Wed, 18 Jun 2014 12:54:27 +0000 (12:54 +0000)]
Merge "BUG-582: optimize replaceWithCamelCase"

10 years agoBUG-582: optimize replaceWithCamelCase
Robert Varga [Sun, 8 Jun 2014 10:23:13 +0000 (12:23 +0200)]
BUG-582: optimize replaceWithCamelCase

Optimize replaceWithCamelCase() by not instantiating a string just to do
a toUppserCase.

Also the initial character lookup is done on the original string, such
that we can elide any object instantiation if the character to be
removed is not found.

Change-Id: Iee81f1967d47a63668bf14b319a2f46715e6866b
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoMerge "BUG-1196, Bug 886: Refactored implementation of Choice Codec"
Tony Tkacik [Wed, 18 Jun 2014 09:13:04 +0000 (09:13 +0000)]
Merge "BUG-1196, Bug 886: Refactored implementation of Choice Codec"

10 years agoBUG-1196, Bug 886: Refactored implementation of Choice Codec
Martin Vitez [Tue, 17 Jun 2014 11:12:13 +0000 (13:12 +0200)]
BUG-1196, Bug 886: Refactored implementation of Choice Codec

Choice Codec and instantiation of Choice Case codecs
was updated to reuse common reactive instatiation
of mixin codec provided by LocationAwareDispatchCodec
which provides utilities to retrieve all instantiation
of cases in their right context, so codecs
use corect namespaces and see only cases which
are really available in particular subtree.

Serialization of Cases was updated to
use namespace from schema context if and only
if case is added by augmentation.

Added test which test serialization / deserialization.

Change-Id: Id2ff269b6d124a35bdca7f687114d3fa123091d5
Signed-off-by: Martin Vitez <mvitez@cisco.com>
10 years agoRevert "BUG-1196: fixed bug in choice case codec."
Tony Tkacik [Tue, 17 Jun 2014 19:17:52 +0000 (19:17 +0000)]
Revert "BUG-1196: fixed bug in choice case codec."

This reverts commit 92e4fd194891f567aad81f36352aaf9c80df7838.

Change-Id: I2cf16d72002fce3f8de5ff16008f62a74dc834d5
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
10 years agoBUG-1196: fixed bug in choice case codec.
Martin Vitez [Tue, 17 Jun 2014 11:12:13 +0000 (13:12 +0200)]
BUG-1196: fixed bug in choice case codec.

Implemented lazy generation of choice case codecs by
using DispatchChoiceCodecImpl - delegator for de/serialization
of case instances in
PublicChoiceCodecImpl. This codec is created for each interface
generated from yang choice. It contains information about all
implementations of choice-cases in context and delegate
de/serialization of concrete case instance to correct case
codec based on given InstanceIdentifier.

ChoiceCaseCodecImpl instances are created when concrete case
is encountered.

By using DispatchChoiceCodecImpl we don't need to hold
COMPOSITE_TO_CASE and CLASS_TO_CASE_MAP variables in runtime
generated codec which were
used to serialization and deserialization before.

Added test which test serialization / deserialization.

Change-Id: I52eb78f66e91695758b825b109639d039860f997
Signed-off-by: Martin Vitez <mvitez@cisco.com>
10 years agoMerge "BUG-865: replaced deprecated code from binding-generator-util."
Tony Tkacik [Fri, 13 Jun 2014 11:59:40 +0000 (11:59 +0000)]
Merge "BUG-865: replaced deprecated code from binding-generator-util."

10 years agoMerge changes I6b5ca1b6,Ib9703600,I5eb25590,I5ea885e0,I08ba5d2c
Tony Tkacik [Fri, 13 Jun 2014 11:58:11 +0000 (11:58 +0000)]
Merge changes I6b5ca1b6,Ib9703600,I5eb25590,I5ea885e0,I08ba5d2c

* changes:
  BUG-1143: refactored ChoiceCaseGenTypesTest.
  BUG-1143: refactored AugmentRelativeXPathTest.
  BUG-1143: refactored AugmentedTypeTest.
  BUG-1143: added AbstractTypesTest as base for generated types testing.
  BUG-865: removed use of deprecated methods from tests.

10 years agoMerge "BUG-1069: made InstanceIdentifier.PathArgument implement Comparable."
Tony Tkacik [Fri, 13 Jun 2014 11:56:31 +0000 (11:56 +0000)]
Merge "BUG-1069: made InstanceIdentifier.PathArgument implement Comparable."

10 years agoMerge "BUG-865: replaced deprecated code from yang-binding."
Tony Tkacik [Fri, 13 Jun 2014 11:53:38 +0000 (11:53 +0000)]
Merge "BUG-865: replaced deprecated code from yang-binding."

10 years agoBUG-1069: made InstanceIdentifier.PathArgument implement Comparable.
Martin Vitez [Thu, 12 Jun 2014 15:32:31 +0000 (17:32 +0200)]
BUG-1069: made InstanceIdentifier.PathArgument implement Comparable.

Change-Id: Ib89d5a4240205234f707290e69f29d80841e3504
Signed-off-by: Martin Vitez <mvitez@cisco.com>
10 years agoBUG-1143: refactored ChoiceCaseGenTypesTest.
Martin Vitez [Fri, 13 Jun 2014 11:24:06 +0000 (13:24 +0200)]
BUG-1143: refactored ChoiceCaseGenTypesTest.

Removed test sources which are irrelevant for choice case generated type testing.

Signed-off-by: Martin Vitez <mvitez@cisco.com>
10 years agoBUG-865: replaced some deprecated code from binding-type-provider.
Martin Vitez [Thu, 12 Jun 2014 11:32:29 +0000 (13:32 +0200)]
BUG-865: replaced some deprecated code from binding-type-provider.

Signed-off-by: Martin Vitez <mvitez@cisco.com>
10 years agoBUG-1143: refactored AugmentRelativeXPathTest.
Martin Vitez [Fri, 13 Jun 2014 10:02:38 +0000 (12:02 +0200)]
BUG-1143: refactored AugmentRelativeXPathTest.

Removed test sources which are irrelevant for relative path augment generated type testing.

Signed-off-by: Martin Vitez <mvitez@cisco.com>
10 years agoBUG-1143: refactored AugmentedTypeTest.
Martin Vitez [Fri, 13 Jun 2014 09:37:49 +0000 (11:37 +0200)]
BUG-1143: refactored AugmentedTypeTest.

Removed test sources which are irrelevant for augment generated type testing.

Signed-off-by: Martin Vitez <mvitez@cisco.com>
10 years agoBUG-1143: added AbstractTypesTest as base for generated types testing.
Martin Vitez [Fri, 13 Jun 2014 09:11:17 +0000 (11:11 +0200)]
BUG-1143: added AbstractTypesTest as base for generated types testing.

Signed-off-by: Martin Vitez <mvitez@cisco.com>
10 years agoBUG-865: removed use of deprecated methods from tests.
Martin Vitez [Wed, 11 Jun 2014 15:49:20 +0000 (17:49 +0200)]
BUG-865: removed use of deprecated methods from tests.

Removed use of deprecated methods from parser in binding-generator-impl tests.

Change-Id: I08ba5d2c2abc55b818e389502512f35774a90db3
Signed-off-by: Martin Vitez <mvitez@cisco.com>
10 years agoBug 1193: Use format string correctly and fix corresponding unit test
Rob Adams [Fri, 13 Jun 2014 00:52:56 +0000 (17:52 -0700)]
Bug 1193: Use format string correctly and fix corresponding unit test
as well

Change-Id: Ib05078ee9045f60cff663407aa401045ac9d885b
Signed-off-by: Rob Adams <readams@readams.net>
10 years agoBUG-865: replaced deprecated code from yang-binding.
Martin Vitez [Thu, 12 Jun 2014 13:03:19 +0000 (15:03 +0200)]
BUG-865: replaced deprecated code from yang-binding.

Removed groupId declaration from pom (duplicate of parent groupId).

Signed-off-by: Martin Vitez <mvitez@cisco.com>
10 years agoBUG-865: replaced deprecated code from binding-generator-util.
Martin Vitez [Thu, 12 Jun 2014 11:45:10 +0000 (13:45 +0200)]
BUG-865: replaced deprecated code from binding-generator-util.

Signed-off-by: Martin Vitez <mvitez@cisco.com>
10 years agoBUG-1172: nested uses-augmentation fails in code-generation phase.
Martin Vitez [Wed, 11 Jun 2014 14:02:12 +0000 (16:02 +0200)]
BUG-1172: nested uses-augmentation fails in code-generation phase.

Added test case.

Change-Id: I22e506fcaf4f643f5cecb995e3e5f0e5d8ef1fa8
Signed-off-by: Martin Vitez <mvitez@cisco.com>
10 years agoMerge "Fixed mismatch in ietf-restconf-version variable"
Tony Tkacik [Mon, 9 Jun 2014 12:41:50 +0000 (12:41 +0000)]
Merge "Fixed mismatch in ietf-restconf-version variable"

10 years agoFixed mismatch in ietf-restconf-version variable
Giovanni Meo [Mon, 9 Jun 2014 07:11:25 +0000 (09:11 +0200)]
Fixed mismatch in ietf-restconf-version variable

- ietf-restconf-version is defined to be 2013.09.04.1-SNAPSHOT while
the module is defined to be 2013.10.19.1-SNAPSHOT. The mismatch causes
issue in the usage as well in the releasing process

Change-Id: Ieee018314370416fc3ba37e0f7f7eb2f1f55c06b
Signed-off-by: Giovanni Meo <gmeo@cisco.com>
10 years agoMerge "bug 1128:POM Restructuring for Automated Release"
Robert Varga [Fri, 6 Jun 2014 15:03:05 +0000 (15:03 +0000)]
Merge "bug 1128:POM Restructuring for Automated Release"

10 years agobug 1128:POM Restructuring for Automated Release
Vaishali Mithbaokar [Thu, 10 Apr 2014 01:39:04 +0000 (18:39 -0700)]
bug 1128:POM Restructuring for Automated Release

Temporarily hosting odlrootparent as part of the project just for review purpose

Change-Id: Ia9f14f1f5544e3ef5a543cf8e0e904fb31ffbeee
Signed-off-by: Surekha Bejgam <sbejgam@cisco.com>
Signed-off-by: Vaishali Mithbaokar <vmithbao@cisco.com>
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoBUG-582: do not call hashCode() from IdentifiableItem.equals()
Robert Varga [Fri, 6 Jun 2014 12:37:25 +0000 (14:37 +0200)]
BUG-582: do not call hashCode() from IdentifiableItem.equals()

This call would make sense if we had cached hashCode -- but we do not.
We have two options here, either cache hashCode, or not call it from
equals().

Tracing ODL identified that the only other caller of
hashCode() is HashCodeBuilder.nextHashCode() -- thus the hash code is
used only once.

So caching it would add useless overhead of 4 bytes -- so let's just say
no to that.

Change-Id: I19ae0e5025fb6aec5b4d1019b55976ca5ca2e9d4
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoBUG-582: eliminate useless null checks
Robert Varga [Fri, 6 Jun 2014 12:19:37 +0000 (14:19 +0200)]
BUG-582: eliminate useless null checks

These checks are not useful, as the fields checked have been verified to
be non-null. Also optimizes AbstractPathArgument.hashCode() by directly
referring to the type -- we assume storing the PathArgument alongside
with the class is not going to be used very often.

Change-Id: Id3f4d67819de8462801823880e482a480843fa1e
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoBUG-582: optimize InstanceIdentifier.firstIdentifierOf()
Robert Varga [Thu, 5 Jun 2014 21:46:21 +0000 (23:46 +0200)]
BUG-582: optimize InstanceIdentifier.firstIdentifierOf()

Performance tracing of OpenFlow components found that we are spending
cycles copying arguments in create() when called from firstIdentifierOf().
This does not make sense, as we know the argument list is immutable in
this code path.

As it turns out, the copy guard in create() is not sufficient to prevent
the copy, as the Iterables.limit() instantiates a FluentIterable, not an
ImmutableCollection.

This patch elides the copy by splitting the non-copy part of logic of
create() to a private method, internalCreate(). firstIdentifierOf()
calls this method directly, while create() calls it after potentially
creating a copy.

Change-Id: I5c3dbb5c6b5e26d30a0bb407822f1d40fcc898f5
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoBUG-868: migrate to SchemaPath.create()
Robert Varga [Thu, 5 Jun 2014 21:59:32 +0000 (23:59 +0200)]
BUG-868: migrate to SchemaPath.create()

Removes deprecated direct use of constructor in favor of using factory
method.

Change-Id: Ifc49b7a565d971baad2181715b9104e3bf02ea8f
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoMerge "Improved sorting of augmentations before code generation."
Tony Tkacik [Fri, 6 Jun 2014 08:24:42 +0000 (08:24 +0000)]
Merge "Improved sorting of augmentations before code generation."

10 years agoMerge "Bug 1027: Fixed generation of static QNAME field"
Robert Varga [Mon, 2 Jun 2014 15:18:23 +0000 (15:18 +0000)]
Merge "Bug 1027: Fixed generation of static QNAME field"

10 years agoBug 1027: Fixed generation of static QNAME field
Tony Tkacik [Thu, 22 May 2014 11:10:55 +0000 (13:10 +0200)]
Bug 1027: Fixed generation of static QNAME field

All YANG modeled entities such as containers, lists
which have Binding-aware interface associated with
it should have static field QNAME with their respective
from YANG models. Only exception are augmentations
which do not have explicit name.

Instance Identifier codec relies on this existence
of QName which was not true for classes derived from
RPC Input and RPC Output

The code was changed to fix this issue:

BindingGeneratorImpl:
  Updated to include QName for all YANG modeled
  data container.

BindingReflections:
  ClassToQNameLoader was updated to derive correct
  qname for RPC inputs and RPC outputs for models
  which was compiled with missing QName field.

Change-Id: I190f569037cb4e88cf2edc7f18c436cf3eb86aeb
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
10 years agoMerge "Bug 1113 - ietf-restconf needs to specify the version of ietf-yangtypes that...
Tony Tkacik [Fri, 30 May 2014 13:39:50 +0000 (13:39 +0000)]
Merge "Bug 1113 - ietf-restconf needs to specify the version of ietf-yangtypes that must be imported."