mdsal.git
9 years agoBUG-576: fixed possible null pointer dereference in BindingGeneratorImpl
Martin Vitez [Tue, 26 Aug 2014 11:28:58 +0000 (13:28 +0200)]
BUG-576: fixed possible null pointer dereference in BindingGeneratorImpl

Possible null pointer dereference of resultTOBuilder.

Change-Id: I5f50f1ca0fb19d7310e5278f8f6915e6dd180723
Signed-off-by: Martin Vitez <mvitez@cisco.com>
9 years agoFixed breakage of uses generation in Binding
Tony Tkacik [Mon, 25 Aug 2014 13:08:10 +0000 (15:08 +0200)]
Fixed breakage of uses generation in Binding

Change-Id: I0913de13f426906ca8fd2f5e131b022444194648
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoMerge "BUG-1537: improved YangModuleInfo."
Tony Tkacik [Mon, 25 Aug 2014 10:32:33 +0000 (10:32 +0000)]
Merge "BUG-1537: improved YangModuleInfo."

9 years agoMerge changes If1e9a750,Ib530560c,Id01393c3,I2d375382,Id60447ef,I350611fb,I0dbd80db
Tony Tkacik [Mon, 25 Aug 2014 10:25:30 +0000 (10:25 +0000)]
Merge changes If1e9a750,Ib530560c,Id01393c3,I2d375382,Id60447ef,I350611fb,I0dbd80db

* changes:
  BUG-1611: make sure runtime components create short comments
  BUG-1611: force maven plugin generating verbose comments
  BUG-1611: make verbose comments optional
  BUG-1611: use CharMatcher to remove characters
  BUG-1611: drop a FIXME for thread-safety
  BUG-1611: do not instantiate splitters needlessly
  BUG-1611: fix SimpleDateFormat

9 years agoMerge "BUG-1605: Fixup yang-data-api interface"
Tony Tkacik [Mon, 25 Aug 2014 07:59:30 +0000 (07:59 +0000)]
Merge "BUG-1605: Fixup yang-data-api interface"

9 years agoMerge "BUG-1605: Fix yang-binding interfaces"
Tony Tkacik [Mon, 25 Aug 2014 07:59:24 +0000 (07:59 +0000)]
Merge "BUG-1605: Fix yang-binding interfaces"

9 years agoBUG-1611: make sure runtime components create short comments
Robert Varga [Sun, 24 Aug 2014 20:12:09 +0000 (22:12 +0200)]
BUG-1611: make sure runtime components create short comments

The two instantiations here are performance-critical at runtime, and the
comments in them get discarded. Let us not waste time generating them.

Change-Id: If1e9a7507dac5b07011d3a9bcc75e42fbff340e1
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-1611: force maven plugin generating verbose comments
Robert Varga [Sun, 24 Aug 2014 20:07:36 +0000 (22:07 +0200)]
BUG-1611: force maven plugin generating verbose comments

This just makes sure we are explicit about what we are creating.

Change-Id: Ib530560c11e7f529345085eecf43a9f6f2e6d1a6
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-1611: make verbose comments optional
Robert Varga [Sun, 24 Aug 2014 20:03:35 +0000 (22:03 +0200)]
BUG-1611: make verbose comments optional

Make sure the yang snippets are completely optional. The default still
includes them.

Change-Id: Id01393c384add733c42baf6c02a153ef388bb628
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-1611: use CharMatcher to remove characters
Robert Varga [Sun, 24 Aug 2014 19:44:32 +0000 (21:44 +0200)]
BUG-1611: use CharMatcher to remove characters

Instead of compiling the patterns, use a CharMatcher, which is much
faster.

Change-Id: I2d3753824c63d3dece7af6f051f09c644cfdbf34
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-1611: drop a FIXME for thread-safety
Robert Varga [Sun, 24 Aug 2014 19:40:00 +0000 (21:40 +0200)]
BUG-1611: drop a FIXME for thread-safety

Caching a module means the class is not safe for use from multiple
threads.

Change-Id: Id60447efe4dbae4b65748b99870bd75b70b6fcc8
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-1611: do not instantiate splitters needlessly
Robert Varga [Sun, 24 Aug 2014 19:33:34 +0000 (21:33 +0200)]
BUG-1611: do not instantiate splitters needlessly

The two splitters can be easily shared -- so do that instead of
instantiating them.

Change-Id: I350611fb5985b4336018562012526ca1910bb9a2
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-1611: fix SimpleDateFormat
Robert Varga [Sun, 24 Aug 2014 19:32:35 +0000 (21:32 +0200)]
BUG-1611: fix SimpleDateFormat

The format used is incirrect and it makes no sense to instantiate the
utility all over again. Use the yang-common utility instead.

Change-Id: I0dbd80db6726aeb80e6666a330964d58bc08455c
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-1605: Fixup yang-data-api interface
Robert Varga [Fri, 22 Aug 2014 17:27:48 +0000 (19:27 +0200)]
BUG-1605: Fixup yang-data-api interface

Now that the binding interface is ready to handle IOExceptions, adjust
the data-api interface and implementations. At the same time we update
the binding world to forward calls to flush().

Change-Id: I8a4cff13123d618634dcd61587a2432d3d49ae8b
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-1605: Fix yang-binding interfaces
Robert Varga [Fri, 22 Aug 2014 17:42:23 +0000 (19:42 +0200)]
BUG-1605: Fix yang-binding interfaces

This is the frontend piece visible from Binding world. The
implementation relies of the data.api mechanics, so it needs to be
prepared first.

Change-Id: I4694f74e993bbfa9c84578dee04fdd49b87453b7
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-1537: improved YangModuleInfo.
Martin Vitez [Thu, 21 Aug 2014 13:14:41 +0000 (15:14 +0200)]
BUG-1537: improved YangModuleInfo.

YangModuleInfo is generated also for submodules in form as inner class in YangModuleInfo class of
module to which it belongs. Method YangModuleInfo.getImportedModules() returns also YangModuleInfo
classes of submodules which this module includes.
Added getSubmodules() method to Module interface.
Added test.

Change-Id: Id949835d960eee3197d249f7a83be2975a63d6b3
Signed-off-by: Martin Vitez <mvitez@cisco.com>
9 years agoMerge "Fix ordering fields in generated type builder"
Tony Tkacik [Thu, 21 Aug 2014 13:45:11 +0000 (13:45 +0000)]
Merge "Fix ordering fields in generated type builder"

9 years agoMerge "BUG-1425: fix LazyDataObject.toString()"
Tony Tkacik [Thu, 21 Aug 2014 13:41:54 +0000 (13:41 +0000)]
Merge "BUG-1425: fix LazyDataObject.toString()"

9 years agoMerge "add new tests BindingTypesTest, BaseYangTypesTest"
Lukas Sedlak [Thu, 21 Aug 2014 09:40:51 +0000 (09:40 +0000)]
Merge "add new tests BindingTypesTest, BaseYangTypesTest"

9 years agoMerge "BUG-1382: eliminate QName.getPrefix() from GeneratorImpl.xtend"
Robert Varga [Thu, 21 Aug 2014 09:24:23 +0000 (09:24 +0000)]
Merge "BUG-1382: eliminate QName.getPrefix() from GeneratorImpl.xtend"

9 years agoBUG-1425: fix LazyDataObject.toString()
Robert Varga [Tue, 12 Aug 2014 05:32:07 +0000 (07:32 +0200)]
BUG-1425: fix LazyDataObject.toString()

A major usability improvement is skipping of null fields, as dumping
them adds quite a bit of verbosity to logs.

Change-Id: I94c030f11505718ee48b0e3f4556587a85f8f4e4
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBug 1443: Fixed incorrect throw of IllegalArgumentException in getAugmentation
Tony Tkacik [Wed, 20 Aug 2014 08:55:10 +0000 (10:55 +0200)]
Bug 1443: Fixed incorrect throw of IllegalArgumentException in getAugmentation

Change-Id: If58292afba9c634fb4368f70d541d4a7cdf02cf6
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoBUG-1382: eliminate QName.getPrefix() from GeneratorImpl.xtend
Martin Vitez [Wed, 20 Aug 2014 09:58:55 +0000 (11:58 +0200)]
BUG-1382: eliminate QName.getPrefix() from GeneratorImpl.xtend

Change-Id: Ie5fdaf7fc7389c13af8aa591bf9531ed26cb11a9
Signed-off-by: Martin Vitez <mvitez@cisco.com>
9 years agoadd new tests BindingTypesTest, BaseYangTypesTest
Peter Bandzi [Tue, 19 Aug 2014 08:37:53 +0000 (10:37 +0200)]
add new tests BindingTypesTest, BaseYangTypesTest

Signed-off-by: Peter Bandzi <pbandzi@cisco.com>
Change-Id: I289a15eb735c12d4664ff68e73c6e2fc830c6f20

9 years agoMerge "Bug 1531: Fixed incorrect use of leaf types in BindingGeneratorImpl"
Robert Varga [Tue, 19 Aug 2014 11:14:19 +0000 (11:14 +0000)]
Merge "Bug 1531: Fixed incorrect use of leaf types in BindingGeneratorImpl"

9 years agoBug 1531: Fixed incorrect use of leaf types in BindingGeneratorImpl
Tony Tkacik [Tue, 19 Aug 2014 09:39:45 +0000 (11:39 +0200)]
Bug 1531: Fixed incorrect use of leaf types in BindingGeneratorImpl

Change-Id: Id420d1e2b8aadcf0061fcf87910b749e9be89c04
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoBUG-1382: eliminate QName.getPrefix() from binding-generator-impl.
Martin Vitez [Tue, 19 Aug 2014 09:11:41 +0000 (11:11 +0200)]
BUG-1382: eliminate QName.getPrefix() from binding-generator-impl.

Change-Id: Idce1e0efe18c6034ec036794007ea2716799d889
Signed-off-by: Martin Vitez <mvitez@cisco.com>
9 years agoMerge "BUG-1555: skip choices which are not valid in a particular context"
Tony Tkacik [Tue, 19 Aug 2014 07:14:04 +0000 (07:14 +0000)]
Merge "BUG-1555: skip choices which are not valid in a particular context"

9 years agoBUG-1555: skip choices which are not valid in a particular context
Robert Varga [Mon, 18 Aug 2014 11:44:43 +0000 (13:44 +0200)]
BUG-1555: skip choices which are not valid in a particular context

We are enumerating the use of a case in all the possible contexts, which
may partially fail. Instead of failing completely, just skip the
offending case.

Change-Id: Icbf137266784e0f469a258b2bb312db4e01bd8f6
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoFix Precondition formatting
Robert Varga [Thu, 14 Aug 2014 19:47:59 +0000 (21:47 +0200)]
Fix Precondition formatting

Preconditions need to be formatted just like String.format().

Change-Id: I4011a6cc6a5f5cb7b0460885d956f775ff45d97c
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoFix ordering fields in generated type builder
Ladislav Borak [Fri, 8 Aug 2014 13:38:38 +0000 (15:38 +0200)]
Fix ordering fields in generated type builder

Methods is sorted alphabetically to make the order of evaluation
predictable.

Change-Id: Ie1171a78a17e6eab71b629411f0b0a1bb1807d7d
Signed-off-by: Ladislav Borak <lborak@cisco.com>
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoFix conflict on Object definition
Robert Varga [Wed, 13 Aug 2014 12:49:59 +0000 (14:49 +0200)]
Fix conflict on Object definition

The use of Object (in the java.lang sense) is not working with models
which contain a 'container object' or similar. The fix is to not use a
temporary variable.

Change-Id: I98b3bde9a04d5f33a51a0add107829ad92d35907
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-1425: fix builder's implementation of equals()
Robert Varga [Mon, 11 Aug 2014 21:39:36 +0000 (23:39 +0200)]
BUG-1425: fix builder's implementation of equals()

With the advent of LazyDataObject, we have two implementation which need
to compare as equal. LazyObject.equals(builderObject) already works, but
we need the revers to be true, too. This patch sets out to do exactly
that.

Change-Id: I931f66a9088451524a842f6a67e8492ac922fd3d
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "BUG-1425: fix toString() invocation on LazyObject"
Lukas Sedlak [Mon, 11 Aug 2014 14:23:29 +0000 (14:23 +0000)]
Merge "BUG-1425: fix toString() invocation on LazyObject"

9 years agoBUG-1425: fix toString() invocation on LazyObject
Robert Varga [Mon, 11 Aug 2014 14:02:28 +0000 (16:02 +0200)]
BUG-1425: fix toString() invocation on LazyObject

When we are coming in from toString(), the proxy invocation does not
work. Extract getAugmentations() into a private method and use that
instead.

Change-Id: Ia851560b7703817f6d75887fa7e80037292e3fd1
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBug 1443: Implemented Lazy deserialization using dynamic proxies
Tony Tkacik [Thu, 7 Aug 2014 17:06:17 +0000 (19:06 +0200)]
Bug 1443: Implemented Lazy deserialization using dynamic proxies

Result objects from translation from NormalizedNode to Binding Data
are lazily deserialized and initial cost of deserialization
is only one allocation.

Nested data are lazily deserialized once they are accessed.
This decreases time spent on eager deserialization of data
which never was accessed.

Implementation is mostly carried out in
LazyDataObject - InvocationHandler which maps proxy, data and codec
DataContainerPrototype - Prototype of DataContainerContext,
which holds only neccessary information to instantiate real context
DataObjectCodecContext - Context which holds various mapping
required for serialization / deserialization of data.

Also renames AugmentationNode to AugmentationNodeContext to keep naming
consistent and hides it from outside world, as it is
implementation-specific detail.

Change-Id: I94d994277bd0319e9aabcf842e0a741871713a30
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBug 1443: Added support for Union type & OSGI Runtime
Tony Tkacik [Wed, 6 Aug 2014 13:02:05 +0000 (15:02 +0200)]
Bug 1443: Added support for Union type & OSGI Runtime

Introduced new marker interface SchemaUnawareCodec
which marks codecs for simple value types,
which are unaffected by introduction of new modules
(practically everything except union, instance identifier
 and identity codecs). Reworked caching to cache only these
codecs.

Added integration with OSGI, which ensures proper class loading
and updates Javassist classpool if necessary.

Updated ModuleContext to not populate type to schema fields
with empty augmentations, which are undetectable in
data tree.

Change-Id: I2a2c8477e9fdc2ef53bd9f81956023c0760d620e
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoMerge "Bug 1372 - toString methods in generated classes"
Tony Tkacik [Fri, 8 Aug 2014 07:20:19 +0000 (07:20 +0000)]
Merge "Bug 1372 - toString methods in generated classes"

9 years agoMerge "BUG-1436: deprecate IntermediateMapping"
Tony Tkacik [Thu, 7 Aug 2014 20:16:41 +0000 (20:16 +0000)]
Merge "BUG-1436: deprecate IntermediateMapping"

9 years agoMerge "Fixed incorrect test location."
Tony Tkacik [Thu, 7 Aug 2014 20:16:10 +0000 (20:16 +0000)]
Merge "Fixed incorrect test location."

9 years agoMigrate test asserts
Robert Varga [Sun, 3 Aug 2014 12:51:21 +0000 (14:51 +0200)]
Migrate test asserts

With update to JUnit 4.11 we need to migrate tests to use
proper non-deprecated methods/classes. Also removes wildcard imports.

Change-Id: I969f482a2dd85242fd32c22e7c5807d643e3e554
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-1436: deprecate IntermediateMapping
Robert Varga [Thu, 7 Aug 2014 13:53:59 +0000 (15:53 +0200)]
BUG-1436: deprecate IntermediateMapping

IntermediateMapping is only used in CompositeNode-related codecs and
thus is scheduled to be removed at the same time as CompositeNodes.

Change-Id: Ifff06e62441e5f8cc2eac069145389201f369493
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBug 1372 - toString methods in generated classes
Ladislav Borak [Thu, 7 Aug 2014 11:41:09 +0000 (13:41 +0200)]
Bug 1372 - toString methods in generated classes

- changed generated toString method in BaseTemplate,
  added info about simple name of class

Change-Id: I1e4142a9d78205b497f8ed552ac72d1440029b46
Signed-off-by: Ladislav Borak <lborak@cisco.com>
9 years agoMerge "Bug 1372 - toString methods in generated classes"
Tony Tkacik [Thu, 7 Aug 2014 06:13:41 +0000 (06:13 +0000)]
Merge "Bug 1372 - toString methods in generated classes"

9 years agoMerge "Fix sonar not reporting unit tests"
Tony Tkacik [Wed, 6 Aug 2014 15:54:07 +0000 (15:54 +0000)]
Merge "Fix sonar not reporting unit tests"

9 years agoFix sonar not reporting unit tests
Ladislav Borak [Wed, 6 Aug 2014 14:38:39 +0000 (16:38 +0200)]
Fix sonar not reporting unit tests

Enables jacoco plugin (uncodnitionally for now) to get sonar to pickup
the stats.
Changed TypeDefinitionCompilationTest because synthetic fields.

Change-Id: I6baced1cd3ed1a10b790c8a7f11348febc1a380b
Signed-off-by: Robert Varga <rovarga@cisco.com>
Signed-off-by: Ladislav Borak <lborak@cisco.com>
9 years agoBUG-1487: refactor StreamWriterGenerator
Robert Varga [Tue, 5 Aug 2014 16:30:05 +0000 (18:30 +0200)]
BUG-1487: refactor StreamWriterGenerator

This is a reorganization of the StreamWriterGenerator such that it is
properly split up into classes, with contracts clarified. It also
prevents outside subclassing. Also cache pre-made serializer instances.

Change-Id: I492d73a082c24c03b8d17f3868e4a497c8f64b7b
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-1487: use prototypes for instantiating codecs
Robert Varga [Tue, 5 Aug 2014 14:37:01 +0000 (16:37 +0200)]
BUG-1487: use prototypes for instantiating codecs

Optimizes the per-class overhead by copying a prototype class, and then
setting the proper serializer name. At the same time we get rid of the
static serializer methods, making the interface a bit cleaner.
Additionally, we hide the AbstractStreamWriterGenerator, so that to have
a proper boundary.

Change-Id: Ia7d56ff16e1eec7204fa087c49f2ee55a658a377
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "Bug 1432 - Generated DTOs for types use inefficient instantiation"
Tony Tkacik [Wed, 6 Aug 2014 09:22:59 +0000 (09:22 +0000)]
Merge "Bug 1432 - Generated DTOs for types use inefficient instantiation"

9 years agoBug 1432 - Generated DTOs for types use inefficient instantiation
Ladislav Borak [Wed, 30 Jul 2014 17:32:00 +0000 (19:32 +0200)]
Bug 1432 - Generated DTOs for types use inefficient instantiation

- changed method for generating default instance value
- only for types (boolean, byte, short, int and long)

Change-Id: I4a423f3569ed84f4d6aff8efe97a110045c6e7c7
Signed-off-by: Ladislav Borak <lborak@cisco.com>
9 years agoBug 1439, Bug 1443 Binding Codec NormalizedNodeWriter support
Tony Tkacik [Fri, 1 Aug 2014 17:28:13 +0000 (19:28 +0200)]
Bug 1439, Bug 1443 Binding Codec NormalizedNodeWriter support

Added initial implementation of Code generator for Binding Stream Writers
which uses NormalizedNodeStreamWriter on the backend
to write data.

Change-Id: Icae22fd1b9ed4256022650d3ad16b38c577f3d3a
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "BUG-865: Remove SchemaServiceListener"
Tony Tkacik [Mon, 4 Aug 2014 18:15:00 +0000 (18:15 +0000)]
Merge "BUG-865: Remove SchemaServiceListener"

9 years agoBug 1232 - Add snippet of yang file into comments
Ladislav Borak [Thu, 31 Jul 2014 22:59:32 +0000 (00:59 +0200)]
Bug 1232 - Add snippet of yang file into comments

- reworked all proposals from Tom Pantelis
- tested with toaster.yang, generated javadoc files added
  as attachment into bugzilla

Change-Id: I6a6c8a6f6592b1abf9368e9b8232263a029460a8
Signed-off-by: Ladislav Borak <lborak@cisco.com>
9 years agoMerge "Bug 1475: Correctly handle case of typedef that extends boolean"
Martin Vitez [Mon, 4 Aug 2014 08:15:17 +0000 (08:15 +0000)]
Merge "Bug 1475: Correctly handle case of typedef that extends boolean"

9 years agoRemove unused imports
Robert Varga [Sun, 3 Aug 2014 12:04:17 +0000 (14:04 +0200)]
Remove unused imports

Lowers the number of warnings a bit.

Change-Id: I9cbb9f0bd2f711fa4f7410a5023c73497a59f35e
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-865: Remove SchemaServiceListener
Robert Varga [Thu, 31 Jul 2014 13:08:17 +0000 (15:08 +0200)]
BUG-865: Remove SchemaServiceListener

Eradicates the long-deprecated SchemaServiceListener.
SchemaContextListener is the new name for the equivalent service.

Requires controller to merge I15d495d805eb7a08c3bcd3ab0cf8b5a8d2797db5.

Change-Id: I38185b131e9745c0cad366c38428e8be9a8fb4fe
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBug 1475: Correctly handle case of typedef that extends boolean
Ed Warnicke [Sun, 3 Aug 2014 20:09:14 +0000 (15:09 -0500)]
Bug 1475: Correctly handle case of typedef that extends boolean

Change-Id: I892ddb39b56cbd17ea22f07a94f4c2c2dd9ed448
Signed-off-by: Ed Warnicke <eaw@cisco.com>
9 years agoMerge "Updated creation of Binding Spec Context to provide additional information."
Robert Varga [Sun, 3 Aug 2014 10:36:24 +0000 (10:36 +0000)]
Merge "Updated creation of Binding Spec Context to provide additional information."

9 years agoMerge "Runtime Codec cleanup"
Robert Varga [Sun, 3 Aug 2014 10:33:48 +0000 (10:33 +0000)]
Merge "Runtime Codec cleanup"

9 years agoUpdated creation of Binding Spec Context to provide additional information.
Tony Tkacik [Fri, 1 Aug 2014 17:18:28 +0000 (19:18 +0200)]
Updated creation of Binding Spec Context to provide additional information.

Change-Id: I0c71d8b3cb3a569b340fc0ef0c71283382fe2ac6
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoRuntime Codec cleanup
Tony Tkacik [Fri, 1 Aug 2014 17:15:36 +0000 (19:15 +0200)]
Runtime Codec cleanup

- Extracted Augmentation getter to Bidning Reflections
- Fixed retrieval of IdenfierCodec

Change-Id: Ib6b6f45349bd8b5b055dccd036549ec727c0186d
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoMerge "Bug 1119 - Optimize generated range checks"
Robert Varga [Fri, 1 Aug 2014 15:38:01 +0000 (15:38 +0000)]
Merge "Bug 1119 - Optimize generated range checks"

9 years agoBug 1119 - Optimize generated range checks
Ladislav Borak [Wed, 30 Jul 2014 21:56:02 +0000 (23:56 +0200)]
Bug 1119 - Optimize generated range checks

- moved initialization of range and length constraints list
  into static initialization block

Change-Id: I2f5631fceb0e776fe3172e9a05ee97b7fe81252b
Signed-off-by: Ladislav Borak <lborak@cisco.com>
9 years agoMerge "Bug 1436: Introduced BindingStreamEventWriter interface"
Robert Varga [Fri, 1 Aug 2014 13:50:22 +0000 (13:50 +0000)]
Merge "Bug 1436: Introduced BindingStreamEventWriter interface"

9 years agoBug 1436: Introduced BindingStreamEventWriter interface
Tony Tkacik [Mon, 28 Jul 2014 11:36:48 +0000 (13:36 +0200)]
Bug 1436: Introduced BindingStreamEventWriter interface

Introduced BindingStreamEventWriter interface,
which allows to implement Binding codecs
with plugable backend for actual serialization.

This interface needs to present in yang.binding
package, since this in only package which
is imported by all generated YANG Java Bindings
and thus visible for them.

Change-Id: I2d235cd63ecda1d63c8077854a38a5dc9d184d2d
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoMerge changes Ic9936326,I9b600761
Tony Tkacik [Fri, 1 Aug 2014 07:54:20 +0000 (07:54 +0000)]
Merge changes Ic9936326,I9b600761

* changes:
  BUG-865: move ClassLoaderUtils into util package
  BUG-865: prepare to move ListenerRegistry

9 years agoBUG-865: move ClassLoaderUtils into util package
Robert Varga [Wed, 30 Jul 2014 06:42:45 +0000 (08:42 +0200)]
BUG-865: move ClassLoaderUtils into util package

Removes the two previously-deprecated instances, deprecate the third one
and instantiate the utility at the proper place.

Change-Id: Ic9936326fb0f4d4b2129562ae84b131b79746c23
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoOptimize binding types memory usage
Robert Varga [Fri, 18 Jul 2014 09:48:42 +0000 (11:48 +0200)]
Optimize binding types memory usage

Profiling SP edition shows that we have ~30000 empty ArrayList instances
retained by binding.generator.generated.type.builder objects, wasting
around 800kB of memory.

This patch introduces LazyCollections, which allow us to build up these
lists in a manner which uses minimal collections to support the elements
currently present.

Change-Id: I4676356f7684c9cdd152c98a65a240d0c5b94259
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-1092: rename data.api.InstanceIdentifier to YangInstanceIdentifier
Robert Varga [Tue, 29 Jul 2014 10:13:03 +0000 (12:13 +0200)]
BUG-1092: rename data.api.InstanceIdentifier to YangInstanceIdentifier

On popular request to clear up confusion between
yang.binding.InstanceIdentifier and yang.data.api.InstanceIdentifier, we
rename the latter (which is the low-level one). This will make it clear
for users of GUIs, who were confused by the tools giving them the choice
between the two.

Change-Id: I1e30a0df93d8bfb891d047c58abcb117d4006c76
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoFixed incorrect test location.
Lukas Sedlak [Tue, 29 Jul 2014 08:39:43 +0000 (10:39 +0200)]
Fixed incorrect test location.

Fixed incorrect test file location.
Fixed Ignored test in ClassCodeGeneraterTest to test negative case scenario instead of being ingored.

Signed-off-by: Lukas Sedlak <lsedlak@cisco.com>
Change-Id: Ia059c1578f0d61e97cf98f6dd4b0b191d2273dc1

9 years agoBUG-1431: make InstnaceIdentifier serializable
Robert Varga [Mon, 28 Jul 2014 20:43:38 +0000 (22:43 +0200)]
BUG-1431: make InstnaceIdentifier serializable

Straightforward fix for serializability.

Change-Id: I6681e6c85a4ebb8bf23d4dc239204b3a757ea942
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBug 1372 - toString methods in generated classes
Ladislav Borak [Sun, 27 Jul 2014 21:03:23 +0000 (23:03 +0200)]
Bug 1372 - toString methods in generated classes

- changed generated toString method in BaseTemplate,
  added info about simple name of class

Change-Id: I297dec72d3c908bab128b47fd5286a93fc347da3
Signed-off-by: Ladislav Borak <lborak@cisco.com>
9 years agoBUG-1381: remove getLock() and deprecated constructor
Robert Varga [Fri, 25 Jul 2014 13:37:26 +0000 (15:37 +0200)]
BUG-1381: remove getLock() and deprecated constructor

All users have been updated to synchronize properly, now remove
getLock(). At the same time, shed the deprecated contructor, too.
Requires I3e962f284132b376f77e9e2665b3fbb47f246514 to go into controller
first.

Change-Id: Ic8b62468a4e829f035e45b3c715966315b3103a0
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "Degrade DataNodeContainer.getChildNodes() from Set to Collection"
Tony Tkacik [Mon, 28 Jul 2014 15:03:00 +0000 (15:03 +0000)]
Merge "Degrade DataNodeContainer.getChildNodes() from Set to Collection"

9 years agoMerge "Fix Ip{Address,Prefix}Builder performance"
Tony Tkacik [Mon, 28 Jul 2014 15:01:27 +0000 (15:01 +0000)]
Merge "Fix Ip{Address,Prefix}Builder performance"

9 years agoDegrade DataNodeContainer.getChildNodes() from Set to Collection
Robert Varga [Sat, 26 Jul 2014 02:17:52 +0000 (04:17 +0200)]
Degrade DataNodeContainer.getChildNodes() from Set to Collection

Datastore-geared workload shows that around 1% of CPU is being used by
AbstractDocumentedDataNodeContainer.getChildNodes(). Of that, around 72%
is spent in ImmutableSet.copyOf(). We could perform that copy in the
constructor, but we can actually do better.

As it turns out, there is already a childNodes map, which is immutable
and indexed via QName present. That indexing guarantees that the values
compare as distinct, so we can reuse childNodes.values(), except for the
contract.

None of the callers care if the return is a Collection, so downgrade the
return, such that we can elide copying the stuff completely. Also fixup
all the callers. Requires https://git.opendaylight.org/gerrit/#/c/9340/
to fix controller-based users.

Change-Id: I310b351d80955a37f6672064dd238bb9cb1e16b1
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge changes I1a5340f1,I9bb2bdd9
Martin Vitez [Mon, 28 Jul 2014 07:20:10 +0000 (07:20 +0000)]
Merge changes I1a5340f1,I9bb2bdd9

* changes:
  Implement DatastoreIdentifierBuilder
  Add String to known-immutable classes

9 years agoImplement DatastoreIdentifierBuilder
Robert Varga [Sat, 26 Jul 2014 15:50:13 +0000 (17:50 +0200)]
Implement DatastoreIdentifierBuilder

This is straightforward enough, so make it work with BA clients.

Change-Id: I1a5340f1ac72148e11cb54554acbb49540251f88
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoFix Ip{Address,Prefix}Builder performance
Robert Varga [Fri, 25 Jul 2014 15:58:48 +0000 (17:58 +0200)]
Fix Ip{Address,Prefix}Builder performance

Using String.matches() incurs major overhead of almost 4ms. Precompile
the pattern and be smart about the use of it. At the same time do a
small optimization to HostBuilder in the form of not instantiating
multiple matchers.

Change-Id: Ifc7f5ff90e71c545acc00275d84780cebe02ec1c
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "BUG-1381: guide users to use external synchronized block"
Tony Tkacik [Fri, 25 Jul 2014 11:17:10 +0000 (11:17 +0000)]
Merge "BUG-1381: guide users to use external synchronized block"

9 years agoCodecs can handle the same yang "case" from multiple resources
Martin Sunal [Fri, 25 Jul 2014 09:39:42 +0000 (11:39 +0200)]
Codecs can handle the same yang "case" from multiple resources

- resolves a problem when the same case statements are augmented through different paths

Change-Id: I85a0972e352556c525ab64e093e77ad33abeedba
Signed-off-by: Martin Sunal <msunal@cisco.com>
9 years agoMerge "BUG-1414: fix InstanceIdentifier.child(Class, Object)"
Tony Tkacik [Fri, 25 Jul 2014 08:10:53 +0000 (08:10 +0000)]
Merge "BUG-1414: fix InstanceIdentifier.child(Class, Object)"

9 years agoMerge "BUG-1407 fix."
Tony Tkacik [Fri, 25 Jul 2014 07:58:43 +0000 (07:58 +0000)]
Merge "BUG-1407 fix."

9 years agoBUG-1407 fix.
Alex Fan [Thu, 24 Jul 2014 21:04:15 +0000 (14:04 -0700)]
BUG-1407 fix.

Change-Id: I4a7dbcbdbed61593d0096fa01a32af41a4cec4da
Signed-off-by: Alex Fan <railor33@gmail.com>
9 years agoBUG-1381: guide users to use external synchronized block
Robert Varga [Wed, 16 Jul 2014 20:56:41 +0000 (22:56 +0200)]
BUG-1381: guide users to use external synchronized block

This will prevent potential misuses and allow us to scale the utility
class further.

Change-Id: I14bbbf76ccfc7e0ff7942880b25d1f6d5964283e
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-1414: fix InstanceIdentifier.child(Class, Object)
Robert Varga [Thu, 24 Jul 2014 11:42:18 +0000 (13:42 +0200)]
BUG-1414: fix InstanceIdentifier.child(Class, Object)

The result of the method is always a KeyedInstanceIdentifier, so let's
not force users to use casts.

Change-Id: Icabb8999445ff64936e7a32a69eacfc2c9647c64
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoSpeed up augmentable class serialization
Robert Varga [Thu, 24 Jul 2014 11:08:37 +0000 (13:08 +0200)]
Speed up augmentable class serialization

During debugging an unrelated issue, we have noticed the following
cropping up in thread dumps quite often:

java.lang.Thread.State: RUNNABLE
  at sun.reflect.Reflection.getCallerClass(Native Method)
  at java.lang.Class.getDeclaredField(Unknown Source)
  at org.opendaylight.yangtools.sal.binding.generator.impl.LazyGeneratedCodecRegistry$AugmentableDispatchCodec.getAugmentations(LazyGeneratedCodecRegistry.java:977)
  at org.opendaylight.yangtools.sal.binding.generator.impl.LazyGeneratedCodecRegistry$AugmentableDispatchCodec.serialize(LazyGeneratedCodecRegistry.java:968)
  at org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.bandwidth.object.Bandwidth$Broker$Codec$DOM.toDomStatic(Bandwidth$Broker$Codec$DOM.java)
  at org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.pcep.client.attributes.path.computation.client.reported.lsp.Path$Broker$Codec$DOM.toDomStatic(Path$Broker$Codec$DOM.java)

Leading to conjecture that the native call is pretty costly. This
patch introduces a weakly-keyed cache of reflection handles, which
should improve performance.

Change-Id: Ie7001df912c47c77bee8127a2258e8a6a4dce469
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "Documented Augmentable Codec"
Robert Varga [Thu, 24 Jul 2014 10:29:16 +0000 (10:29 +0000)]
Merge "Documented Augmentable Codec"

9 years agoDocumented Augmentable Codec
Tony Tkacik [Thu, 24 Jul 2014 08:01:24 +0000 (10:01 +0200)]
Documented Augmentable Codec

Change-Id: Icecb78a557d41b49bce4af673aeae247c8b258d3
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoMerge "BUG-979: reworked data schema nodes ordering"
Tony Tkacik [Tue, 22 Jul 2014 09:30:32 +0000 (09:30 +0000)]
Merge "BUG-979: reworked data schema nodes ordering"

9 years agoMerge "Revert "BUG-1097: implemented check for null or empty list in builder classes.""
Tony Tkacik [Mon, 21 Jul 2014 15:54:59 +0000 (15:54 +0000)]
Merge "Revert "BUG-1097: implemented check for null or empty list in builder classes.""

9 years agoRevert "BUG-1097: implemented check for null or empty list in builder classes."
Tony Tkacik [Mon, 21 Jul 2014 14:03:50 +0000 (14:03 +0000)]
Revert "BUG-1097: implemented check for null or empty list in builder classes."

This reverts commit 883ae26ee98953a5df7cc0956afa807a82d58a3a
which was breakage in Binding Specification and should not
be merged without community-wide discussion.

Change-Id: Ifda1124d974b1ce299551be80a84c45b85b4155a
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoMerge "BUG-865: get rid of InstanceIdentifier-related warnings"
Tony Tkacik [Mon, 21 Jul 2014 13:12:05 +0000 (13:12 +0000)]
Merge "BUG-865: get rid of InstanceIdentifier-related warnings"

9 years agoMerge "Bug 1329: Use original definition for searching for java class."
Martin Vitez [Mon, 21 Jul 2014 12:45:43 +0000 (12:45 +0000)]
Merge "Bug 1329: Use original definition for searching for java class."

9 years agoMerge "Bug 626 - It should be possible to create java doc"
Martin Vitez [Mon, 21 Jul 2014 09:46:04 +0000 (09:46 +0000)]
Merge "Bug 626 - It should be possible to create java doc"

9 years agoBUG-865: get rid of InstanceIdentifier-related warnings
Robert Varga [Mon, 21 Jul 2014 09:04:12 +0000 (11:04 +0200)]
BUG-865: get rid of InstanceIdentifier-related warnings

InstanceIdentifier has a few deprecated methods, which are still used
all over the place. Migrate their users to new equivalents.

Change-Id: Ifba5dbaee9e3f2a74bc084b085095712f422fb46
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBug 626 - It should be possible to create java doc
Ladislav Borak [Thu, 10 Jul 2014 12:39:45 +0000 (14:39 +0200)]
Bug 626 - It should be possible to create java doc

- added interface for documented types
- added fieldto for builders GTO and GT
- modified print method in BaseTemplate, EnumTemplate, ClassTemplate and
  and Interface template
  - fix for Bug 1001 - added description for enum constants
  - fix for Bug 1002 - changed formatting of type description

Change-Id: I5b0ea61369ff86243740d83282a2c4a3115be733
Signed-off-by: Ladislav Borak <lborak@cisco.com>
9 years agoBUG-1097: implemented check for null or empty list in builder classes.
Martin Vitez [Thu, 17 Jul 2014 14:18:00 +0000 (16:18 +0200)]
BUG-1097: implemented check for null or empty list in builder classes.

If one of builder variable is List, do following:
 - for null value create Collections.emptyList()
 - for empty list create Collections.emptyList()
 - for any other list create ImmutableList.copyOf(<arg>)

Added test.

Change-Id: I83e5aaf4f4253aa2e195c23ff5b48b04fc883052
Signed-off-by: Martin Vitez <mvitez@cisco.com>
9 years agoMerge changes Ibfbb4deb,I96e28324
Tony Tkacik [Mon, 21 Jul 2014 08:21:35 +0000 (08:21 +0000)]
Merge changes Ibfbb4deb,I96e28324

* changes:
  BUG-1377: fixed code generation for nodes defined under grouping.
  BUG-865: removed unused utility methods from SchemaContextUtil

9 years agoMerge "BUG-1276: fixed generated union constructor"
Tony Tkacik [Mon, 21 Jul 2014 08:15:04 +0000 (08:15 +0000)]
Merge "BUG-1276: fixed generated union constructor"