mdsal.git
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"

9 years agoMerge "BUG-532: implemented copy constructor for generated builder classes."
Tony Tkacik [Mon, 21 Jul 2014 08:13:14 +0000 (08:13 +0000)]
Merge "BUG-532: implemented copy constructor for generated builder classes."

9 years agoMerge "BUG-1388: fixed ClassTemplate to avoid unused import of BigInteger."
Robert Varga [Fri, 18 Jul 2014 14:04:25 +0000 (14:04 +0000)]
Merge "BUG-1388: fixed ClassTemplate to avoid unused import of BigInteger."

9 years agoBindingGeneratorUtil.computeDefaultSUID() should not modify lists
Robert Varga [Fri, 18 Jul 2014 09:21:55 +0000 (11:21 +0200)]
BindingGeneratorUtil.computeDefaultSUID() should not modify lists

This prevents the utility from churning the lists passed in. Also
shares the comparator.

Change-Id: Iaded850b5b0fa98d79e4e4fdbed52175c669e8a4
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-1388: fixed ClassTemplate to avoid unused import of BigInteger.
Martin Vitez [Fri, 18 Jul 2014 08:43:36 +0000 (10:43 +0200)]
BUG-1388: fixed ClassTemplate to avoid unused import of BigInteger.

Change-Id: I88e3aa6c9456603360de2053b5a2bbeca4877aa7
Signed-off-by: Martin Vitez <mvitez@cisco.com>
9 years agoBUG-1377: fixed code generation for nodes defined under grouping.
Martin Vitez [Thu, 17 Jul 2014 10:23:54 +0000 (12:23 +0200)]
BUG-1377: fixed code generation for nodes defined under grouping.

If node was defined in choice case which parent choice was defined in grouping,
node does not implement ChildOf interface. Fixed by adding search for parent node
also from groupings.

Added test.

Change-Id: Ibfbb4deb719804fd16cce5c091cc0969aeaf821e
Signed-off-by: Martin Vitez <mvitez@cisco.com>
9 years agoBUG-865: removed unused utility methods from SchemaContextUtil
Martin Vitez [Thu, 17 Jul 2014 07:38:40 +0000 (09:38 +0200)]
BUG-865: removed unused utility methods from SchemaContextUtil

By using getOriginal method from DerivableSchemaNode we can avoid searching for original node from grouping. This causes
that some of utility methods from SchemaContextUtil become redundant.

Change-Id: I96e2832436331b2f454e21aedb01fb552e2e2d6e
Signed-off-by: Martin Vitez <mvitez@cisco.com>
9 years agoTurned off codec source code generation by default.
Tony Tkacik [Thu, 17 Jul 2014 08:02:25 +0000 (10:02 +0200)]
Turned off codec source code generation by default.

Change-Id: Iad6eda63c109e3d813c704e2eda56b067c7d1688
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoMerge "Output generated codec source to files"
Tony Tkacik [Thu, 17 Jul 2014 07:17:22 +0000 (07:17 +0000)]
Merge "Output generated codec source to files"

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-979: reworked data schema nodes ordering
Martin Vitez [Wed, 9 Jul 2014 06:54:21 +0000 (08:54 +0200)]
BUG-979: reworked data schema nodes ordering

This patch changes ordering of child nodes - nodes are ordered as they are declared in
yang file (before they were sorted in alphabetical order). This ordering is applied for
schema node builders and also for schema node instances.

Change-Id: I628d40be638fc56ee3e4e1ff9c161ab1cf88ae19
Signed-off-by: Martin Vitez <mvitez@cisco.com>
9 years agoBUG-532: implemented copy constructor for generated builder classes.
Martin Vitez [Wed, 16 Jul 2014 08:03:41 +0000 (10:03 +0200)]
BUG-532: implemented copy constructor for generated builder classes.

Added test.

Change-Id: Ic9d6b4c80b431978a624c7a0d7cd0f7f71d4bb8c
Signed-off-by: Martin Vitez <mvitez@cisco.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 agoBUG-1276: fixed generated union constructor
Martin Vitez [Wed, 9 Jul 2014 14:17:59 +0000 (16:17 +0200)]
BUG-1276: fixed generated union constructor

Current generated definition of union constructor

public UnionType(Arg1 _arg1) {
  super();
  this._arg1 = _arg1;
  this._arg2 = null;
  this._value = null;
}

was incorrect and setting this._value == null was replaced with setting _value to correct value, for example:

this._value = arg1.getValue()
or
this._value = _arg1.getValue().toString().toCharArray()

Change-Id: I837e5e1fc6845937d19abcdc8e2f8d52b410d316
Signed-off-by: Martin Vitez <mvitez@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 agoBug 1329: Use original definition for searching for java class.
Tony Tkacik [Mon, 14 Jul 2014 15:04:52 +0000 (17:04 +0200)]
Bug 1329: Use original definition for searching for java class.

Change-Id: I667c5370e45353626c65099c57876b2f8c60ab91
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>
9 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."

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