mdsal.git
5 years agoDo not inline NodeContextSuppliers 67/81867/4
Robert Varga [Wed, 1 May 2019 20:46:04 +0000 (22:46 +0200)]
Do not inline NodeContextSuppliers

As it turns out, NodeContextSuppliers really need to be coming
from parent, as we can be rehosting objects into different
namespaces -- in which case a single object will need to be
interpreted in terms of the NodeContextSupplier in its parent,
i.e. with a different schema.

This patch undoes most of Iaf227e78d2b6546d34c2133fc31912c0a8dde4b3
and I9e24c30535c536d70b4eb60035b5aa744fc6ec9d, in that
NodeContextSuppliers are not inlined as constants, but rather
looked up.

Unlike the previous lookup by method name, we are using localName
and Class, just as we do in stremers and hence we are reusing
indices which support streamers.

The ability to inlike NodeContextSuppliers is retained, but since
DataObjectContext does not have enough information from
BindingRuntimeContext, this facility is not used.

JIRA: MDSAL-443
Change-Id: I82bff8657845bdab27aa3aa8c24a949c4758f1bb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoOptimize DataObjectCodecContext memory footprint 72/81872/1
Robert Varga [Thu, 2 May 2019 10:27:58 +0000 (12:27 +0200)]
Optimize DataObjectCodecContext memory footprint

Examining heap dumps while working on MDSAL-442/MDSAL-443 revealed
a slight inefficiency in DataObjectCodecContext: we are forcing
byStreamClass's entrySet to be instantiated for the purposes of
copying it into byBindingArgClassBuilder.

This patch corrects the mistake by using byStreamClassBuilder
as the source of copied entries -- which holds the same content,
but we will be throwing it away.

Furthermore byStreamClass and byBindingArgClass are only distinct
when we have a choice child, hence we also run comparison on the
two builders and reuse byStreamClass if they are equal.

Change-Id: Ie58367f7cc899d49da7f78cd0d4e70fbb064ae99
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoFix raw type warnings in CodecDataObjectBridge 71/81871/1
Robert Varga [Thu, 2 May 2019 06:23:33 +0000 (08:23 +0200)]
Fix raw type warnings in CodecDataObjectBridge

CodecDataObjectGenerator is generic, use a wildcard type to prevent
raw type warnings.

JIRA: MDSAL-444
Change-Id: I1d8dffce449a7129e59cc3a70400056fd843b15c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoDefend against nulls in ValueContext 61/81861/2
Robert Varga [Wed, 1 May 2019 17:18:57 +0000 (19:18 +0200)]
Defend against nulls in ValueContext

We should never attempt to deserialize null values for keys,
defend against them.

Change-Id: I6439bb6ce22da11476cd4f8bd89e3ec04c05ba96
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoIntroduce AbstractAugmentable 50/81850/5
Robert Varga [Wed, 1 May 2019 14:29:00 +0000 (16:29 +0200)]
Introduce AbstractAugmentable

Binding generated code hand-implements handling of augmentations,
which leads to some amount of duplicated code, but notably a lot
of distinct implementations of Augmentatable.augmentation().

We can improve the situation by providing a simple base class which
holds an immutable map of augmentations implementing
AugmentationHolder and Augmentable interfaces.

JIRA: MDSAL-445
Change-Id: I693cd4fbec3d236f039e01448dc4994722b5582d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoDo not use ClassToInstanceMap in AugmentableCodecDataObject 53/81853/2
Robert Varga [Wed, 1 May 2019 15:05:46 +0000 (17:05 +0200)]
Do not use ClassToInstanceMap in AugmentableCodecDataObject

ImmutableClassToInstanceMap is implemented using delegation,
which means we end up allocating one more object than we really
need and are also adding an indirection.

Drop back to using a plain ImmutableMap, so as to reduce memory
pressure.

JIRA: MDSAL-442
Change-Id: I6832eb8f012a2d003d3a2158009305a09f6c7832
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoIgnore dependency-reduced-pom.xml 49/81849/2
Robert Varga [Wed, 1 May 2019 14:33:57 +0000 (16:33 +0200)]
Ignore dependency-reduced-pom.xml

dependency-reduced-pom.xml is created as part of the shading process,
make sure we ignore it in the workspace.

JIRA: MDSAL-444
Change-Id: If85fc6493b4d47201d9a5c6a7fdfb09c32a003c8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoDo not retain java.lang.reflect.Method in ValueNodeCodecContext 29/81829/2
Robert Varga [Tue, 30 Apr 2019 15:39:28 +0000 (17:39 +0200)]
Do not retain java.lang.reflect.Method in ValueNodeCodecContext

We only require method references during DataObjectCodecContext,
after which all we need is their name -- hence we index the map
by Method, as we can get the name from there and we can derive
the former string from the underlying schema, just as we did
before.

Change-Id: Icfb6bc3b89ce313ae054e773bd566c03c16d8a31
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoCheck registration being closed 11/81811/2
Robert Varga [Tue, 30 Apr 2019 03:35:41 +0000 (05:35 +0200)]
Check registration being closed

Check if the registration has been closed before firing events.
This way we stop delivering events a bit sooner, improving shutdown
speed and correctness.

JIRA: MDSAL-429
Change-Id: Id3ce6be0b8b15f4d95a3f54ac9880447a2551833
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoDo not use bound MethodHandle in DataObjectCodecContext 26/81826/2
Robert Varga [Tue, 30 Apr 2019 13:08:30 +0000 (15:08 +0200)]
Do not use bound MethodHandle in DataObjectCodecContext

Binding the MethodHandle means we are actually creating two
methodhandles, which is wasteful. Add a dummy CodecDataObject
constructor argument, unifying constructor signatures and allowing
us to use a single methodhandle, passing 'this' at the single
call site.

JIRA: MDSAL-444
Change-Id: Idd94638eb42d219b7370463d91dad3d00409bd5e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoAdd support for EventInstantAware notifications 80/81580/11
Robert Varga [Thu, 11 Apr 2019 21:11:17 +0000 (23:11 +0200)]
Add support for EventInstantAware notifications

This patch adds support for transmitting DOMEvent contents to
Binding Notifications through the EventInstantAware interface.

The design is such that binding-dom-adapter recognizes DOMEvent
and extracts the instant from it and uses the appropriate codec
call to instantiate a proxy Notification.

On codec side of things, the NotificationCodecContext maintains
a distinct Proxy, which also implements EventInstantAware and
when asked to create a proxy with an instant uses that instead
of the usual LazyDataObject to handle it. In order to make things
seamless and to not impact other LazyDataObject users, this
alternative proxy is serviced by an intermediate InvocationHandler,
which checks if the call is to eventInstance() and if not, it will
delegate to the normal LazyDataObject instance.

JIRA: MDSAL-282
Change-Id: I0dda9a55e4da6231c9bd3be03121a236ce187e47
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoSwitch NormalizedNode->Binding codegen to ByteBuddy 78/81778/35
Robert Varga [Tue, 23 Apr 2019 20:28:22 +0000 (22:28 +0200)]
Switch NormalizedNode->Binding codegen to ByteBuddy

This patch switches code generation for streamers and codec-based
binding objects to use ByteBuddy instead of Javassist.

While this increases the size of our jar considerably, it is
leads to more maintainable and safer code.

JIRA: MDSAL-444
Change-Id: Ib810dd0df6e569b0bb20603a5b0f0180c28ec25c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoTeach BindingNormalizedNodeCache to cache leaf type objects 90/79990/32
Robert Varga [Thu, 11 Apr 2019 15:40:28 +0000 (17:40 +0200)]
Teach BindingNormalizedNodeCache to cache leaf type objects

This adds the final bits to enable CachingNormalizedNodeSerializer
to actually cache leaf objects.

JIRA: MDSAL-407
Change-Id: I39bac36395f4e6809342d48a375d441b49cbc3b8
Signed-off-by: Jie Han <han.jie@zte.com.cn>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoMark YangSchemaUtils for removal 91/81791/2
Robert Varga [Fri, 26 Apr 2019 14:24:40 +0000 (16:24 +0200)]
Mark YangSchemaUtils for removal

This class seems to be unused, mark it for removal consideration
in the next release.

Change-Id: I468167a64e641815ddfd951ced0a19d25d9eb734
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRework DataObjectSerializer implementations 09/81709/20
Robert Varga [Sat, 20 Apr 2019 12:03:42 +0000 (14:03 +0200)]
Rework DataObjectSerializer implementations

This patch rework generation of DataObjectSerializers to base
them on a common superclass and generates them into a target
CodecClassLoader.

This removes pollution of class loaders, while maintaining the
same level of functionality with slightly less byte code.

It also cleans up external interfaces, as the serializers
generation is a purely-internal implementation detail and is not
exposed to outside world -- hence this patch deprecates all
classes and interfaces involved in that former leak.

JIRA: MDSAL-401
Change-Id: I80daff7e05e7487af7dca4e4bdae6b2893c97037
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoDrop a FIXME in DataContainerCodecPrototype 93/81793/3
Robert Varga [Fri, 26 Apr 2019 19:36:30 +0000 (21:36 +0200)]
Drop a FIXME in DataContainerCodecPrototype

Acquisition of the backer is in the hot path now, hence we should
consider if we can safely remove or relax the volatile read here.

Change-Id: I9efe3cd2f45ab97f6c4c9bcc8f18e4cf62542b60
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoCache NodeContextSuppliers in CodecDataObject 15/81715/8
Robert Varga [Tue, 23 Apr 2019 10:26:47 +0000 (12:26 +0200)]
Cache NodeContextSuppliers in CodecDataObject

The binding between DataContainerCodecContext and CodecDataObject
is required only to support decoding child leaves, where we are
looking offset-based lookup.

Since each method has a fixed offset, which directly corresponds
to a NodeContextSupplier, we can short-circuit this lookup by
resolving NodeContextSupplier for each method into constant and
then pass it down to CodecDataObject -- thus side-stepping any
lookups and allowing the constant to be properly propagated.

That unfortunately means we need to initialize the generated class
early, so the fields are resolved in a well-controlled environment
-- for which we are using Customizer.customizeLoading() coupled
with a thread-local context managed by CodecDataObjectBridge.

JIRA: MDSAL-443
Change-Id: I9e24c30535c536d70b4eb60035b5aa744fc6ec9d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoOptimize CodecDataObject dispatch 08/81708/8
Robert Varga [Mon, 22 Apr 2019 20:47:43 +0000 (22:47 +0200)]
Optimize CodecDataObject dispatch

Now that we are in control of our interface between the DataObject
facade and DataObjectCodecContext rather than being forced to work
off of method name, we can optimize the dispatch towards
NodeContextSupplier (and DataObjectCodecContext size) by using
simple offsets to identify which method is being invoked.

On the generated code side of things, this lowers the pressure we
exert on the constant pool by using simple integers instead of
strings.

On the DataObjectCodecContext side, we ditch a Map in favor of a
simple array -- thus lowering memory overhead while also speeding
up dispatch, as it no longer is a Map lookup, but rather straight
get from an offset.

This necessitates special-casing key() method a bit, but the benefits
outweigh the (slight) ugliness we bring in.

JIRA: MDSAL-442
Change-Id: Iaf227e78d2b6546d34c2133fc31912c0a8dde4b3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoSpeed up BindingReflections.getAugmentations() 28/81728/2
Robert Varga [Wed, 24 Apr 2019 09:05:38 +0000 (11:05 +0200)]
Speed up BindingReflections.getAugmentations()

One of the ways in which we can acquire augmentations is through
AugmentationHolder interface. While this is handled through
AugmentationFieldGetter.getGetter(), that is not really efficient
as it requires indirection through multiple implementations.

Since AugmentationFieldGetter is a package-internal implementation
detail, factor the check out into BindingReflections, where it can
execute directly. This not only improves locality, but also allows
us to remove one AugmentationFieldGetter implementation, resulting
in bimorphic invocation.

Change-Id: I15584dbe6151a70d13a766f27b927f598a5d21ba
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoGenerate DataObject codec implementation 54/81654/30
Robert Varga [Mon, 15 Apr 2019 11:50:58 +0000 (13:50 +0200)]
Generate DataObject codec implementation

With the advent of CodecClassLoader we can safely instantiate
codec-specific implementations of binding interfaces instead
of relying on dynamic proxies.

This has several advantages:
- we do not generate a proxy class in public space, hence our mess
  will undergo normal GC rules
- generated code is a normal final class, hence we can inherit
  method implementations from interfaces and subclasses
- for each instance, we do not require a proxy and an invocation
  handler, so we instantiate only one object
- there is no reflection in the invocation path, hence JIT has
  full (and direct) visibility and can perform all of its magic

This patch DataObject support to use this approach, with
(Augmentable)CodecDataObject forming the base class.

The result is a bit more complex than the OpaqueObject case, but
also offers several advantages over the LazyDataObject approach
it replaces:
- nonnullFoo() methods are inherited from the binding interface,
  hence the presence of binding-dom-codec does not prevent CHA
  analysis from concluding there is only a single implementation
  -- thus allowing rapid devirtualization. This also means that
  DataContainerCodecContext no longer needs to track those methods
  or do anything.
- Augmentable interfaces are supported by a separate superclass,
  which implements AugmentationHolder, resulting in augmentations
  field being held only if the binding interface is augmentable
- getters and Identifiable.key() values are held in dedicated
  fields of the generated object. This leads to them being properly
  cached in all cases, hence invoking a getter after an
  equals/hashCode() operation will reuse the cached value if it
  was populated
- since we are using plain fields, data access does not involve
  walking a ConcurrentHashMap, further improving performance

The amount of generated code is kept at a minimum -- methods
just invoke CodecDataObject's method, passing it the ARFU
corresponding to the field as a constant -- and rely on the
compiler to inline the call, so that constants are propagated.

JIRA: MDSAL-442
Change-Id: I6acc34ab6b2cc62fd26dc34275259494ac4541fb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoExpand class customization capabilities 11/81711/5
Robert Varga [Tue, 23 Apr 2019 08:27:51 +0000 (10:27 +0200)]
Expand class customization capabilities

This expands CodecClassLoader.Customizer with the ability to
cross-reference generated classes, so a generated class can
depend on another generated class -- which can potentially live
in a different classloader. This capability is required to support
stream writers, as they delegate to each other.

JIRA: MDSAL-401
JIRA: MDSAL-443
Change-Id: I446dcfe10c742c670f2021123acab600a28c2514
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoSpeed up DataContainerCodecPrototype.get() a bit 12/81712/4
Robert Varga [Tue, 23 Apr 2019 09:38:33 +0000 (11:38 +0200)]
Speed up DataContainerCodecPrototype.get() a bit

We can use less byte code to initialize both the local handle
and the cache field.

Change-Id: I362d0125836c6d962c4366c03ba76ae244fc54e5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoGenerate OpaqueObject implementation 53/81653/19
Robert Varga [Mon, 15 Apr 2019 08:02:03 +0000 (10:02 +0200)]
Generate OpaqueObject implementation

With the advent of CodecClassLoader we can safely instantiate
codec-specific implementations of binding interfaces instead
of relying on dynamic proxies.

This has several advantages:
- we do not generate a proxy class in public space, hence our mess
  will undergo normal GC rules
- generated code is a normal final class, hence we can inherit
  method implementations from interfaces and subclasses
- for each instance, we do not require a proxy and an invocation
  handler, so we instantiate only one object
- there is no reflection in the invocation path, hence JIT has
  full (and direct) visibility and can perform all of its magic

This patch does that for OpaqueObject, which results extremely
simple generated classes: they just subclass a ForeignOpaqueObject
and add the target binding interface.

JIRA: MDSAL-442
Change-Id: I2be5bb88f9557375f517415d6bec9f68e803628c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoAdd codec support for anyxml classes 43/81643/19
Robert Varga [Sun, 14 Apr 2019 09:25:17 +0000 (11:25 +0200)]
Add codec support for anyxml classes

ForeignOpaqueData and ForeignOpaqueObject provide generalized
support for proxying over to yang.data.api.ForeignDataNode, hence
supporting anydata/anyxml in all possible object models.

The codec tree is extended with BindingOpaqueObjectCodecTreeNode,
which supports all OpaqueObjects, with the restriction that only
AnyXmlNodes (i.e. those with DOMSource object model) are supported
due to streaming restrictions in NormalizedNodeStreamWriter.

JIRA: MDSAL-285
Change-Id: I9192008ae169cf49a98f64a218a33d470d134eae
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoAdd support for anyxml node code generation 89/81589/15
Robert Varga [Tue, 9 Apr 2019 21:43:40 +0000 (23:43 +0200)]
Add support for anyxml node code generation

This adds the support for generating OpaqueObject interfaces
based on anyxml nodes.

JIRA: MDSAL-437
Change-Id: Iee4f32449f73833b31444c7659047471758d0c88
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoAdd binding/dom codec class loader support 98/81698/5
Robert Varga [Thu, 18 Apr 2019 11:07:22 +0000 (13:07 +0200)]
Add binding/dom codec class loader support

Our current codec implementation relies on creating classes in
classloaders holding compile-time-generated code, effectively
polluting them, in two distinct ways.

The first, less intrusive, is the instantiation of dynamic
proxies, which support LazyDataObject and ForeignOpaqueObject
instances. Since this is done via JVM interfaces, the JVM
takes care of reusing these classes, but still they cannot
be removed when the binding-dom-codec is unloaded -- fortunately
their nature of being derived from yang-binding and compile-time
generated interfaces allows them to be reused.

The second, more intrusive, is the instantiation of dynamic
streamers to support emitting NormalizedNode structures from
DataObject instances. While there are some provisions to reuse
them, they are inherently tied to how BindingRuntimeContext
interprets generated classes -- if the underlying SchemaContext
ends up interpreting them incompatibly (for example, by leaf
changing to anyxml), we end up between a rock and a hard place --
the classes do not match NormalizedNode world and they cannot
be reloaded to rectify the problem.

This patch adds the infrastructure for separating out compile-time
and run-time worlds by introducing StaticClassPool and
CodecClassLoader. StaticClassPool is used to bind Javassist code
generator to the classloader into which binding-dom-codec is loaded.

CodecClassLoader allows effective bridging of StaticClassPool and
whatever classloader is loading compile-time-generated classes,
and provides a place where new classes can be defined without
polluting either classloader.

Change-Id: I963c7bc6eefd5dd77a80e06442896265116664c0
JIRA: MDSAL-442
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoExtend AugmentableExtension to handle AugmentationHolder 83/81683/3
Robert Varga [Wed, 17 Apr 2019 14:04:28 +0000 (16:04 +0200)]
Extend AugmentableExtension to handle AugmentationHolder

This class seems to be a duplicate of BindingReflections'
functionality, completely missing out on AugmentationHolder, which
can be used as an alternative to expose augmentations.

Change-Id: Iadcc4e2f4587ceeb27d6a47c42b0319705fc1e58
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoMake LazySerializedDOMNotification a DOMEvent 79/81579/3
Robert Varga [Thu, 11 Apr 2019 20:10:16 +0000 (22:10 +0200)]
Make LazySerializedDOMNotification a DOMEvent

DOMEvent carries the information about when the event occurred,
make sure we propagate it when available and backfill it on
submission.

It also retrofits some @NonNull annotations to make it clear we
are not propagating nulls.

JIRA: MDSAL-282
Change-Id: I2153b007af2accbad41f5aea00dbced21030a67d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoOptimize source generation 47/81647/5
Robert Varga [Sun, 14 Apr 2019 14:22:50 +0000 (16:22 +0200)]
Optimize source generation

Since StringBuilder is fluent, we can optimize some of the source
generation utilities to have less bytecode. Also mark FIXMEs for
future improvement, as these would allow better devirtualization.

Furthermore we expose Class-based cast/assign operations, which
trim down code duplication a tiny bit.

Change-Id: I32d9d9321992effe0bec1423990208a92c1f780b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoDefine OpaqueData/OpaqueObject hashCode/equals 90/81590/7
Robert Varga [Fri, 12 Apr 2019 02:09:33 +0000 (04:09 +0200)]
Define OpaqueData/OpaqueObject hashCode/equals

This adds baseline hashCode/equals specification, so that we do not
rely on identity for comparisons.

JIRA: MDSAL-439
Change-Id: I41291935a0402f6fce13b6e49531d85e2fc905d5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoTag generated QNAME field with @NonNull 42/81642/3
Robert Varga [Sun, 14 Apr 2019 07:33:15 +0000 (09:33 +0200)]
Tag generated QNAME field with @NonNull

Improve code generation, so that users can be sure QNAME is never
nullable, improving interactions with APIs which take a QName.

Change-Id: I0454ba448fb9edb605d04e97901381ae0f8a79d0
JIRA: MDSAL-441
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoTag InstanceIdentifier methods with @Nullable/@NonNull 41/81641/3
Robert Varga [Sun, 14 Apr 2019 07:08:33 +0000 (09:08 +0200)]
Tag InstanceIdentifier methods with @Nullable/@NonNull

Most of these methods are guaranteed to return non-null, tag them
as such, improving user experience.

Change-Id: I6f581baf2a023b90274b9d89bf6475d9780449c8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoTag NotificationPublishService.REJECTED as non-null 78/81578/1
Robert Varga [Thu, 11 Apr 2019 20:08:37 +0000 (22:08 +0200)]
Tag NotificationPublishService.REJECTED as non-null

This can only ever be a non-null constant, tag is as such.

Change-Id: I2d011a66fa61b164dab184ab0808a77ee290c774
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoBump version to 4.0.1-SNAPSHOT 77/81577/1
Robert Varga [Thu, 11 Apr 2019 17:14:52 +0000 (19:14 +0200)]
Bump version to 4.0.1-SNAPSHOT

This starts the next release cycle.

Change-Id: Ic3462f2874e72597d6686ad25d16c607e44f7859
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoSpecialize LeafNodeCodecContext for TypeObjects 71/81571/3
Robert Varga [Thu, 11 Apr 2019 14:43:09 +0000 (16:43 +0200)]
Specialize LeafNodeCodecContext for TypeObjects

This adds the gue between BindingTypeObjectCodecTreeNode and
LeafNodeCodecContext, which is necessary to correctly instantiate
leaves from caches.

JIRA: MDSAL-407
Change-Id: Ia636cf513e6581ad098e0887b37119476508063a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoSplit LeafNodeCodeContext and LeafSetNodeCodecContext 70/81570/1
Robert Varga [Thu, 11 Apr 2019 14:07:41 +0000 (16:07 +0200)]
Split LeafNodeCodeContext and LeafSetNodeCodecContext

These are the two basic node contexts we are currently supporting,
split them from ValueNodeContext, properly separating deserializeObject()
implementations.

JIRA: MDSAL-436
Change-Id: Ieeb9c047f980631ab3861bb7e42ef87e52f9552e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRename LeafNodeCodecContext to ValueNodeCodecContext 69/81569/1
Robert Varga [Thu, 11 Apr 2019 13:36:58 +0000 (15:36 +0200)]
Rename LeafNodeCodecContext to ValueNodeCodecContext

'LeafNode' prefix has wrong implications, as it is reminiscent
of nodes from 'leaf' statement, when in fact it covers all nodes
considered 'leaf' values in the Binding Object tree. This covers leaf,
leaf-list, anyxml, anydata -- where leaf-list and leaf have actually
differnent handling.

This renames the class to ValueNodeCodecContext, to make a clear
distinction between the two groups.

JIRA: MDSAL-436
Change-Id: I02d60afc1650319efe6cbd90b12eeb47e5152a8f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoAllow BindingNormalizedNodeCachingCodec on any BindingObject 66/81566/1
Robert Varga [Thu, 11 Apr 2019 11:58:40 +0000 (13:58 +0200)]
Allow BindingNormalizedNodeCachingCodec on any BindingObject

This lowers the requirements so we can have a caching codec for
any BindingObject.

JIRA: MDSAL-407
Change-Id: I1ae3659b277df29743028761e136457c2dfd1a0f
Signed-off-by: Jie Han <han.jie@zte.com.cn>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoAdd BindingTypeObjectCodecTreeNode 58/81558/3
Robert Varga [Thu, 11 Apr 2019 10:14:26 +0000 (12:14 +0200)]
Add BindingTypeObjectCodecTreeNode

This interface supports TypeObject codecs, exposing the appropriate
codec interface.

JIRA: MDSAL-407
Change-Id: Ib45561039b85e051086934e72daa4fa701b600aa
Signed-off-by: Jie Han <han.jie@zte.com.cn>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoSplit BindingNormalizedNodeCache 57/81557/2
Robert Varga [Wed, 10 Apr 2019 18:09:36 +0000 (20:09 +0200)]
Split BindingNormalizedNodeCache

We will end up caching various kinds of BindingObjects, this splits
up BindingNormalizedNodeCache into an abstract base class and a
concrete implementation for DataObjects.

JIRA: MDSAL-407
Change-Id: I7ae0338fa29124cfe4a5f0234fe9dd55e8bc389e
Signed-off-by: Jie Han <han.jie@zte.com.cn>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRework BindingCodecTreeNode 38/81538/8
Robert Varga [Wed, 10 Apr 2019 15:44:43 +0000 (17:44 +0200)]
Rework BindingCodecTreeNode

There is a strong tie-in between NodeCodecContext and
BindingCodecTreeNode, where the latter has massive oversubscription
of context.

This patch separates the semantics out, so that we end up with
cleaner interfaces and proper decomposition of concerns, so that
further binding concepts can be handled by the codec infrastructure.

This is a preparatory patch for both TypedObject caching and
Annotation/OpaqueObject translation.

JIRA: MDSAL-10
JIRA: MDSAL-285
JIRA: MDSAL-407
Change-Id: Ibc8d155b8a91b6081cd0eecd5d25fae56cb4699a
Signed-off-by: Jie Han <han.jie@zte.com.cn>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRemove unneeded suppressions 39/81539/2
Robert Varga [Wed, 10 Apr 2019 19:27:20 +0000 (21:27 +0200)]
Remove unneeded suppressions

Now that implementedInterface() is specialized by DataObject,
we can get rid of raw types and unchecked casts, as we know
the returned Class object is a subclass of DataObject.

Change-Id: I0d148a4437462e7d05384efbb79d935b5b00e9b7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoClean up tryToUseCacheElse() 37/81537/3
Robert Varga [Wed, 10 Apr 2019 12:51:00 +0000 (14:51 +0200)]
Clean up tryToUseCacheElse()

Generated code is a bit ugly for the case of accessing cache,
with missing newline and misplaced whitespace. Clean that up.

Change-Id: I13c754c808b9da19e3f5e4cfc216073aafb462db
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoDocument BindingCodec/Serializer/Deserializer 35/81535/3
Robert Varga [Wed, 10 Apr 2019 11:10:57 +0000 (13:10 +0200)]
Document BindingCodec/Serializer/Deserializer

These interfaces are not documented at all, owing partly to the fact
they are are implementation of mdsal-binding-dom-codec, whose design
currently requires placing codecs into the same class loader as
generated code -- hence they leak to the common binding support
package.

Change-Id: Ib576b9aeddcc644d5b1f44a2047e775cc5266245
JIRA: MDSAL-401
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoFix AbstractBaseType nullness handling 66/81466/5
Robert Varga [Tue, 9 Apr 2019 07:07:26 +0000 (09:07 +0200)]
Fix AbstractBaseType nullness handling

Use requireNonNull() instead of a custom throw, allowing us
to annotate the field as @NonNull, reducing the number of warnings.

Change-Id: I53a64abfed239c3ae76d319479916ca381595324
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoUpdate BindingMapping nullness handling 67/81467/5
Robert Varga [Tue, 9 Apr 2019 07:08:18 +0000 (09:08 +0200)]
Update BindingMapping nullness handling

This annotates all used methods as returning @NonNull, fixing
a number of warnings in users.

Change-Id: I0d8bdf493e92ac66614755807fc34d43da38c10a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRefactor DOMMoutPointServiceImpl UT a little bit 23/81423/3
Jakub Morvay [Sun, 7 Apr 2019 07:01:23 +0000 (09:01 +0200)]
Refactor DOMMoutPointServiceImpl UT a little bit

This refactors DOMMountPointSerivceImplTest unit test. The test now
tries to test DOMMountPointServiceImpl's DOMMountPointService API
contract instead of testing how it is implemented. This way we can
restrict the visibility of some of DOMMountPointServiceImpl members.

Change-Id: I8bd9cd7d659ffd8d32d7ce361f42c9cfec805283
Signed-off-by: Jakub Morvay <jakub.morvay@gmail.com>
5 years agoRemove unneeded javadoc override 71/81471/2
Robert Varga [Tue, 9 Apr 2019 08:51:28 +0000 (10:51 +0200)]
Remove unneeded javadoc override

odlparent is shipping javadoc-plugin-3.1.0, we do not need to override
anymore.

Change-Id: I9cfe5cfd0786373e272773d616db78fb229dc2d2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRe-enable generation of CheckReturnValue 68/81468/3
Robert Varga [Tue, 9 Apr 2019 07:12:53 +0000 (09:12 +0200)]
Re-enable generation of CheckReturnValue

Instead of JSR305 we use spotbugs-annotations here.

Change-Id: I86b1c020632af2c597a48a237ff338955e2a13ea
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoReduce use of getDataChildByName() 65/81465/2
Robert Varga [Tue, 9 Apr 2019 06:47:51 +0000 (08:47 +0200)]
Reduce use of getDataChildByName()

Using findDataChildByName() is null-safe, allowing us to reduce
the number of assertions.

Change-Id: I182f52371aab5b18d94bebcd3a9aaf26b9d5fb55
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoFix ietf-type-util mis-bump 70/81470/1
Robert Varga [Tue, 9 Apr 2019 08:49:28 +0000 (10:49 +0200)]
Fix ietf-type-util mis-bump

This version got accidentally mis-bumped during yangtools-3.0.0
-SNAPSHOT removal, fix that.

Change-Id: I9e872ced1f470a5cfdf28b7f98d54f42f92d5086
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoPush out API FIXMEs 45/81445/5
Robert Varga [Mon, 8 Apr 2019 11:29:42 +0000 (13:29 +0200)]
Push out API FIXMEs

We do not have time to address all these FIXMEs, push them out
to the 5.0.0 release.

Change-Id: Ida1fb72302930a4a48eed58ff78cbf35abd9f19e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoMake WriteOperations.(put,merge) with boolean default methods 44/81444/5
Robert Varga [Mon, 8 Apr 2019 11:20:39 +0000 (13:20 +0200)]
Make WriteOperations.(put,merge) with boolean default methods

This inverts the API, so that implementations are required to
provide implementations of mergeParentStructure{Merge,Put} instead
of the boolean-forking put()/merge() methods, addressing associated
FIXMEs.

Change-Id: I9750982fa1ec833fda17d583e2806d4350618c1c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoHide ShardedDOMReadWriteTransactionAdapter 43/81443/4
Robert Varga [Mon, 8 Apr 2019 11:31:09 +0000 (13:31 +0200)]
Hide ShardedDOMReadWriteTransactionAdapter

As per the FIXME, hide this class and make it final.

Change-Id: Ibfdbad74ab6fa16283da2ab2b109f37805e98961
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRemove DOMDataTreeReadWriteTransaction.close() 42/81442/4
Robert Varga [Mon, 8 Apr 2019 11:10:39 +0000 (13:10 +0200)]
Remove DOMDataTreeReadWriteTransaction.close()

Inheriting from DOMDataTreeReadTransaction was a mistake, read-write
transaction should not have a close() method. Fix that by inheriting
DOMDataTreeReadOperations instead, addressing the associated FIXME.

Change-Id: Ie26e19917bd78acca056c7c79de641b231fa9ea8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoMake DOMDataTreeShardProducer#close() non-default 41/81441/4
Robert Varga [Mon, 8 Apr 2019 11:17:17 +0000 (13:17 +0200)]
Make DOMDataTreeShardProducer#close() non-default

DOMDataTreeShardProducer implementations are now required to provide
a close() method, addressing the associated FIXME.

Change-Id: Ic77a34ccc0fd9af96465a807142cf0b3b5b303ab
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoMake MethodSignature default-related methods required 40/81440/4
Robert Varga [Mon, 8 Apr 2019 11:24:31 +0000 (13:24 +0200)]
Make MethodSignature default-related methods required

This promotes retrofitted isDefault() and setDefault() methods
to be properly required, addressing the associated FIXME.

Change-Id: Ibc958ce02c36a317f9b6f4c04632a3d6cecf0f7c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoBump yangtools to 3.0.0 08/80908/32
Robert Varga [Fri, 15 Mar 2019 17:51:45 +0000 (18:51 +0100)]
Bump yangtools to 3.0.0

This bumps dependencies to yangtools-3.0.0, adjusting for API changes
brought by that change:
- NormalizedNodes no longer have attributes
- DataTreeCandidateNode.getModifiedChild() returns an Optional
- ListenerRegistry is no longer an Iterable
- ClassloaderUtils is using Optional instead of nullable
- NormalizedNodeStreamWriter opens leaf/anyxml/leafsetentry nodes
- leafrefs are using PathExpression instead of RevisionAwareXPath
- path expressions are strictly validated
- QName does not allow '/'
- QueuedNotificationManager.BatchedInvoker operates on ImmutableList

Change-Id: I45b25faaea8b60de974e9ffa2b5761567115fd2a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoBump odlparent to 5.0.0 07/80907/26
Robert Varga [Fri, 15 Mar 2019 17:51:21 +0000 (18:51 +0100)]
Bump odlparent to 5.0.0

This bumps odlparent to 5.0.0.

Change-Id: I90398f344b45c8f55bd92831ea2221c4af34ce5e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoIntegrate PingPongDataBroker into DataBroker contract 96/81396/7
Robert Varga [Fri, 5 Apr 2019 16:25:14 +0000 (18:25 +0200)]
Integrate PingPongDataBroker into DataBroker contract

The ping-pong functionality affects only transaction chains and
can be easily realized as a proxy. This patch provides
PingPongTransactionChain as an SPI utility and introduces a new
method to allocate such transaction chains.

JIRA: MDSAL-432
Change-Id: I06744a7860527d8827c280ab603f5e98077d27b6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoAdd AbstractDOMSchemaService and FixedDOMSchemaService 72/79972/13
Michael Vorburger [Mon, 28 Jan 2019 21:11:36 +0000 (22:11 +0100)]
Add AbstractDOMSchemaService and FixedDOMSchemaService

AbstractDOMSchemaService allows more code reuse between implementations
by holding the common bits needed to interface with SchemaContextProviders.

Also use these to implement a FixedDOMSchemaService for use in situations
when the SchemaContext and the set of associated sources are known to
never change.

This also slightly simplifies ScanningSchemaSourceProvider.

JIRA: MDSAL-418
Change-Id: I554837f8ae93e5bbb741b4cb801c31b8ebfcaa03
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
5 years agoFix small formatting issue 22/81422/2
Jakub Morvay [Sat, 6 Apr 2019 16:17:25 +0000 (18:17 +0200)]
Fix small formatting issue

Change-Id: I48128fee6f2ff9f8e27fb5714cec1fbbd44af2e9
Signed-off-by: Jakub Morvay <jakub.morvay@gmail.com>
5 years agoDo not fail if invoking of listener fails 13/81413/5
Jakub Morvay [Sat, 6 Apr 2019 09:19:13 +0000 (11:19 +0200)]
Do not fail if invoking of listener fails

DOMMountPointServiceImpl should not fail and propagate uncaught
exceptions from mount point listeners. When invocation of a registered
listener onMounPpointCreated or onMounPointRemoved callback fails, just
log the error and continue execution.

Change-Id: I5d182b610c0b5749cfe01efc13bc1dddfffa5283
Signed-off-by: Jakub Morvay <jakub.morvay@gmail.com>
5 years agoRemove deprecated leak method 14/81414/2
Jakub Morvay [Sat, 6 Apr 2019 09:26:05 +0000 (11:26 +0200)]
Remove deprecated leak method

This removes already deprecated DOMMountPointServiceImpl
unregisterMountpoint leak method.

Change-Id: I6a36f0625be9657fbe5ff0337129e990a14cd6c1
Signed-off-by: Jakub Morvay <jakub.morvay@gmail.com>
5 years agoAdd Opaque{Data,Object} interfaces 26/81226/2
Robert Varga [Wed, 27 Mar 2019 15:31:07 +0000 (16:31 +0100)]
Add Opaque{Data,Object} interfaces

This adds the baseline interfaces needed for generating
manifestations of anydata and anyxml node sin Binding world.

Since they are conceptually the same and cannot have the same
identifier, we can support them with a single BindingObject
sub-interface.

JIRA: MDSAL-428
Change-Id: I7d7e0ff6c7bcd7d2375d50c4e976bf68d4e47143
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoAdd yang-binding interfaces for annotations 25/81225/2
Robert Varga [Wed, 27 Mar 2019 13:53:01 +0000 (14:53 +0100)]
Add yang-binding interfaces for annotations

Binding users are interested in having a way to access RFC7952
metadata. While the actual codegen/runtime implementation requires
some work, we know what Binding Specification extension we will
need to support the generated classes.

This patch introduces Annotation and AnnotationAware, so a future
codegen version can bind to it.

JIRA: MDSAL-357
Change-Id: I2fed30ea34b21c36b626388bb37890cc73875176
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoAdd EventInstantAware interface 24/81224/1
Robert Varga [Wed, 27 Mar 2019 12:55:15 +0000 (13:55 +0100)]
Add EventInstantAware interface

This interface will be used to carry the equivalent of RFC5277
notification eventTime. It is modeled exactly the same way as
DOMEvent/DOMNotification, hence it will allow us to bridge the gap
in binding-dom-adapter, where we are losing this information.

JIRA: MDSAL-282
Change-Id: Ie93015c2609a2d1c59df6c63f76511aa68867832
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoClarify DOMEvent and DOMNotification relationship 23/81223/1
Robert Varga [Wed, 27 Mar 2019 12:53:50 +0000 (13:53 +0100)]
Clarify DOMEvent and DOMNotification relationship

The relationship between these interfaces is realized in the
implementation, but it is not captured in the interface contract
documentation.

JIRA: MDSAL-282
Change-Id: I99d8787a16263c6628440dac8b3bd7a6bbec3f9c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoOffload null value checking to CodeHelpers 04/81204/3
Robert Varga [Tue, 26 Mar 2019 19:34:36 +0000 (20:34 +0100)]
Offload null value checking to CodeHelpers

Since we are using a fixed string, we can easily offload the call
to a centralized place in CodeHelpers, thus providing some minor
class size improvements.

Change-Id: I25991e7020bafc535dab6731063e39e92de03d95
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRemove unused imports 05/81205/2
Robert Varga [Tue, 26 Mar 2019 19:37:28 +0000 (20:37 +0100)]
Remove unused imports

These were introduced during MDSAL-48 implementation, remove them
again.

JIRA: MDSAL-48
Change-Id: I1fa1944bd8e1f6e0780cf2fd5d82e3b028d27a4e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoDeleting a non-existent node fails 03/81203/1
Robert Varga [Tue, 26 Mar 2019 18:49:20 +0000 (19:49 +0100)]
Deleting a non-existent node fails

This adds a unit test for deletion of a non-existent node.

JIRA: MDSAL-108
Change-Id: I32d537c7e58a6161147e7e51b80e71cb8aaa0d79
Signed-off-by: Valentin Mayamsin <vmayamsi@cisco.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRemove use of deprecated createCursor() method 96/81196/1
Robert Varga [Tue, 26 Mar 2019 15:21:57 +0000 (16:21 +0100)]
Remove use of deprecated createCursor() method

This method has been superseded by openCursor(), use that.

Change-Id: Ie64c91106c1b1cfddbd0d68456e5081f6ef72341
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoBindingAdapterFactory should be Immutable 84/81184/2
Robert Varga [Tue, 26 Mar 2019 13:04:05 +0000 (14:04 +0100)]
BindingAdapterFactory should be Immutable

This class is immutable, which implies thread-safety, removing
the need for @ThreadSafe.

Change-Id: Ic77c7932a2dd244b0a8211bd6e8c1dc9e95bb08c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRemove @(Not)ThreadSafe annotation 83/81183/2
Robert Varga [Tue, 26 Mar 2019 13:03:15 +0000 (14:03 +0100)]
Remove @(Not)ThreadSafe annotation

Use documentation rather than JSR305 to document non-thread-safety.
In package-private classes these annotations often do not make
sense.

Change-Id: Iea39cf23472917e9d5765e6d2a025ff7ab7f6114
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoDo not throw Exception 37/81137/1
Robert Varga [Mon, 25 Mar 2019 07:22:31 +0000 (08:22 +0100)]
Do not throw Exception

OsgiBundleScanningSchemaService.destroyInstance() does not need
to declare Exception as thrown, remove it to keep sonar happy.

Change-Id: I1bdec43b8c467f4562f33914340fa203f848c317
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoEnable spotbugs in ietf-type-util 24/81124/1
Robert Varga [Fri, 22 Mar 2019 19:01:31 +0000 (20:01 +0100)]
Enable spotbugs in ietf-type-util

This is just a trivial flipping of the switch.

Change-Id: I916c22fee0dd9049359a044be1ee3cb6a4b673fe
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoFix ietf-type-util checkstyle 23/81123/1
Robert Varga [Fri, 22 Mar 2019 18:46:53 +0000 (19:46 +0100)]
Fix ietf-type-util checkstyle

This fixes checkstyle violations, adding a few suppressions and
remove UnsupportedExceptionThrows and related reflection-based tests.

Change-Id: I0c1b8828a881299dde6df4fe666df000f0ec486b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoFix logging arguments 22/81122/1
Robert Varga [Fri, 22 Mar 2019 18:27:10 +0000 (19:27 +0100)]
Fix logging arguments

This is caught by upgraded spotbugs, we are missing returnType
argument.

Change-Id: I5513c89cd22e0c4fd739ada5a2d5e5b61b185a09
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoTolerate unresolvable leafrefs in groupings 42/41142/7
Vratko Polak [Fri, 1 Jul 2016 11:21:15 +0000 (13:21 +0200)]
Tolerate unresolvable leafrefs in groupings

In case a grouping contains a relative leafref pointing outside of
the grouping subtree we cannot safely determine the target type, which
lead to an IllegalArgumentException.

In this case we need to resolve the return type to an Object, which
loses type safety, but really is the best we can do as we just do not
know in what contexts that grouping is used.

Unfortunately this requires API changes to mdsal-binding-generator-api
as we need to communicate the fact we are resolving a type definition
in the context of a grouping to TypeProvider implementations.

JIRA: MDSAL-182
Change-Id: Iaf96d133c08eb47f4bb27b6c4f3db1463b78f05e
Signed-off-by: Vratko Polak <vrpolak@cisco.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoChange 'type empty' mapping 49/80949/13
Robert Varga [Mon, 18 Mar 2019 13:40:29 +0000 (14:40 +0100)]
Change 'type empty' mapping

This patch changes 'type empty' leaves to map to yang.common.Empty,
aligning DOM and Binding representations and removing potential
confusion around what Boolean.FALSE means in the value.

It also eliminates the need for a dedicated codec, as this type is
handled through NOOP_CODEC.

JIRA: MDSAL-48
Change-Id: If43d710d4620cffaecc8ca7d42d1eb00c58370c0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRemove FluentFuture from DOM RPC contracts 33/80933/9
Robert Varga [Sat, 16 Mar 2019 12:01:58 +0000 (13:01 +0100)]
Remove FluentFuture from DOM RPC contracts

FluentFuture cannot be proxied in Guava 27.0, hence we need to drop
to using ListenableFuture to efficiently shortcut invocations.

Change-Id: Ib89742760e0bbfdb6c46aa4bbf99ea35f5823c8b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoCleanup RuntimeException throws 15/81015/2
Robert Varga [Tue, 19 Mar 2019 17:04:49 +0000 (18:04 +0100)]
Cleanup RuntimeException throws

We are just wrapping exceptions in these cases, switch to wrapping
with IllegalStateException to keep sonar happy.

Change-Id: I571f444b9d97dd9d9129b6e18f7e91e72b30d842
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoSpeed up ClassTemplate getDefaultInstance() generation 85/80985/3
Robert Varga [Tue, 19 Mar 2019 11:30:08 +0000 (12:30 +0100)]
Speed up ClassTemplate getDefaultInstance() generation

We can skip instantiating FQCN and just compare against constants,
which results in faster dispatch.

Change-Id: I681888872db411b4f70b3b09d205540d8b607568
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoSpeed up Union stringValue() generation 84/80984/3
Robert Varga [Tue, 19 Mar 2019 11:31:14 +0000 (12:31 +0100)]
Speed up Union stringValue() generation

We can compare against well-known Types, which is faster than
going through FQCN.

Change-Id: I7f6a7bd143d94be48176d9d8e1fe56bd0e6eae8e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoSimplify UnionTemplate stringValue() dispatch 83/80983/3
Robert Varga [Tue, 19 Mar 2019 11:19:41 +0000 (12:19 +0100)]
Simplify UnionTemplate stringValue() dispatch

We have a complicated if in two cases, simplify it and take
advantage of Types.BYTE_ARRAY.

Change-Id: Ib413d5f987b0dd15cf29fbc429bde68bc35c1379
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRemove DataContainer.getImplementedInterface() 51/80951/10
Robert Varga [Mon, 18 Mar 2019 14:11:14 +0000 (15:11 +0100)]
Remove DataContainer.getImplementedInterface()

This method conflicts with user data and has been supplanted
by implementedInterface().

This patch removes it from codebase and instantiates a test for
the conflict.

JIRA: MDSAL-395
Change-Id: I3c2f6699a0785dbc353f3118883168b0e84407b1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoGenerate implementedInterface 94/77894/40
Robert Varga [Fri, 23 Nov 2018 18:48:03 +0000 (19:48 +0100)]
Generate implementedInterface

getImplementedInterface() is trampling on getter namespace, making
it possible to clash with a user-supplied model. It also is not properly
overridden in generated code.

Fix both these issues by introducing DataContainer.implementedInterface()
and overriding it as needed wither with a narrower specification
(groupings) or a default implementation (other interfaces).

JIRA: MDSAL-396
Change-Id: I902350f0979067a9e035770e683ab18e966deb7f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRemove DOMMountPointServiceImpl.registerMountPoint() 86/80186/4
Jakub Morvay [Thu, 7 Feb 2019 10:35:22 +0000 (11:35 +0100)]
Remove DOMMountPointServiceImpl.registerMountPoint()

This method is a leak and was deprecated in 3.0.x, remove it now in 4.0.0.

Change-Id: Ieb7c0d81872851e68dc231b5be653e782c7ed9c4
Signed-off-by: Jakub Morvay <jmorvay@frinx.io>
5 years agoImplement EthertypeBuilder 29/80929/7
Robert Varga [Sat, 16 Mar 2019 11:03:00 +0000 (12:03 +0100)]
Implement EthertypeBuilder

This implements EthertypeBuilder in an efficient way, using
pre-built known ethertypes.

It also defines {compare,equal,hash}Value, methods which perform
semantic operations, treating number-based and enumeration-based
Ethertypes equally.

Change-Id: I394f65a17fa84c06a63bc598c947d274d6dd6413
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoUse E$$ to capture augmentation type 50/80950/2
Robert Varga [Mon, 18 Mar 2019 13:55:43 +0000 (14:55 +0100)]
Use E$$ to capture augmentation type

'E' is a valid generated identifier, which can lead to conflicts
when generating augmentable implementations.

Change-Id: I9d69d06e18301eff788c101e389a6d0b5365ad38
JIRA: MDSAL-425
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoFix check path contention when create tree producers 19/76919/18
han [Fri, 12 Oct 2018 03:16:19 +0000 (11:16 +0800)]
Fix check path contention when create tree producers

- It's not allowed to create producers with their subtrees conflicts.
  Add a map to store producers aim to do this check more simply than
  to travel 'DOMDataTreePrefixTable'.
  It's assumed there're less producers in th map that we could accept
  to do 'for' operation.

  JIRA: MDSAL-397
Change-Id: I105291402f21b530f54873307316f0f0c5640f6b
Signed-off-by: Jie Han <han.jie@zte.com.cn>
5 years agoRemove implied @ThreadSafe annotations 32/80932/3
Robert Varga [Sat, 16 Mar 2019 12:00:22 +0000 (13:00 +0100)]
Remove implied @ThreadSafe annotations

Immutable interface contract implies thread safety, there is no
need for these annotations.

Change-Id: I51acabd6eca13690b67a3551ae7180510a5191b0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoFix javadoc HTML5 compliance 31/80931/2
Robert Varga [Sat, 16 Mar 2019 11:57:58 +0000 (12:57 +0100)]
Fix javadoc HTML5 compliance

This fixes up javadocs so that they are HTML5-compliant.

Change-Id: Ie62191a3235903ecba5be46a5423b878afa67553
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRevert "Fix aggregator pom name" 27/80927/1
Robert Varga [Sat, 16 Mar 2019 10:12:17 +0000 (11:12 +0100)]
Revert "Fix aggregator pom name"

This reverts commit 0b318674e2b6f8bc9927960ee0577824976cacee,
as it breaks sonar reports.

Change-Id: I5d85dbb9d8ff84b200604959e060c7169c31e488
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRemove binding spec2 13/80913/1
Robert Varga [Fri, 15 Mar 2019 23:59:32 +0000 (00:59 +0100)]
Remove binding spec2

Binding spec v2 is rather incompatible and we have decided to
not make a jump to it, as it is not really feasible. Rather than
that we will backport its fixes to binding v1 in a gradual way.

Remove all binding-v2 artifacts.

Change-Id: Ic58f13372cfe6cbc6f5088e1e507acac14c11c19
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoCorrect docs declaration 12/80912/1
Robert Varga [Fri, 15 Mar 2019 23:57:55 +0000 (00:57 +0100)]
Correct docs declaration

We should not be declaring yangtools-docs, but rather mdsal-docs.

Change-Id: I1e47f3e8d6154ac29fc7d78da12e96dd07e831a9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoBump version for 4.0.0-SNAPSHOT 11/80911/1
Robert Varga [Fri, 15 Mar 2019 23:45:03 +0000 (00:45 +0100)]
Bump version for 4.0.0-SNAPSHOT

This updates snapshot artifacts for 4.0.0 release train.

Change-Id: I3900cd07963b927b34ecdd60668f47c4a3c3c85b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoAdd RFC8519 models 10/80910/4
Robert Varga [Wed, 13 Mar 2019 12:29:06 +0000 (13:29 +0100)]
Add RFC8519 models

This adds RFC8519 ietf-access-control-list and ietf-packet-fields
models, which are replacing previous instantiation of these models.

Change-Id: I984db5e2fc13c4a4e0b12b3afe4141cf73c1d6d5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRemove use of deprecated constructors 09/80909/2
Robert Varga [Fri, 15 Mar 2019 19:07:06 +0000 (20:07 +0100)]
Remove use of deprecated constructors

Java 11 deprecates most of these constructurs, so let's get rid
of them.

Change-Id: I67c03370c4e8440608e0cece182d87c7ea923258
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoFix logging placeholders 06/80906/3
Robert Varga [Fri, 15 Mar 2019 18:34:00 +0000 (19:34 +0100)]
Fix logging placeholders

Upgraded SpotBugs is finding these, fix them up.

Change-Id: I6209c661ccdf17d886d8c776d96fe6b6a32abc1b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>