mdsal.git
16 months agoBump versions to 11.0.5-SNAPSHOT 95/104095/1
Robert Varga [Mon, 23 Jan 2023 09:45:36 +0000 (10:45 +0100)]
Bump versions to 11.0.5-SNAPSHOT

This starts the next development iteration.

Change-Id: If57c4c2a776554c1892bf23e30b032966eabc059
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
16 months agoFix typedef/bits code generation 41/104041/5
Robert Varga [Mon, 16 Jan 2023 13:42:30 +0000 (14:42 +0100)]
Fix typedef/bits code generation

bits/typedef seemed to be generating code which does not compile.

Add a test to check if the generated code contains desired method and
fix the check for bits type.

JIRA: MDSAL-807
Change-Id: I4618269fff1fc284b65e9efb1d49501248d233c3
Signed-off-by: matus.matok <matus.matok@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
16 months agoAdd Augmentable.augmentationOrElseThrow() 36/104036/5
Robert Varga [Mon, 16 Jan 2023 00:27:40 +0000 (01:27 +0100)]
Add Augmentable.augmentationOrElseThrow()

A number of places assume, or check-or-throw on, presence of a
particular Augmentation. Add convenience methods to short-circuit
the equivalent of Optional.orElseThrow(), so users get more comfort
expressing this.

JIRA: MDSAL-806
Change-Id: I457a93ac1689087a7ceace57489e528b488ed207
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
16 months agoUse instanceof patterns for argument checking 65/104065/1
Robert Varga [Tue, 17 Jan 2023 22:07:13 +0000 (23:07 +0100)]
Use instanceof patterns for argument checking

Eliminate the need for explicit casts by inlining verify(instanceof)
calls.

Change-Id: Ice2508ea44693bac4198b55779f82a9d51cbe514
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
16 months agoAdd FIXMEs to Rpc{Input,Output} 63/104063/1
Robert Varga [Tue, 17 Jan 2023 20:38:10 +0000 (21:38 +0100)]
Add FIXMEs to Rpc{Input,Output}

DataObject has implications which cover the possibility of being an
interior node of a structured data. RpcInput and RpcOutput are
explicitly excluded from that contract, similarly as BaseNotification
is.

Add FIXMEs to reconcile this modeling problem.

Change-Id: I84b6f5ca90cbfb685209559863f29634c5744772
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
16 months agoMore use of instanceof patterns 59/103959/1
Robert Varga [Fri, 6 Jan 2023 22:28:26 +0000 (23:28 +0100)]
More use of instanceof patterns

Reduce the number of explicit casts by integrating them into instanceof
patterns, which leads to reduction of nested if statements in some
cases.

Change-Id: I1255b4c9998faa1ec0de037fc54dc0d79544ed4f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
17 months agoBump versions to 11.0.4-SNAPSHOT 97/103697/1
Robert Varga [Sun, 18 Dec 2022 11:08:25 +0000 (12:08 +0100)]
Bump versions to 11.0.4-SNAPSHOT

This starts the next development iteration.

Change-Id: I3e4125653c6fe0cff8fe61d052fa0b3f9facdf0d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
17 months agoDeprecate DataObjectReadingUtil 65/103665/1
Robert Varga [Tue, 13 Dec 2022 16:50:38 +0000 (17:50 +0100)]
Deprecate DataObjectReadingUtil

This class is not used anywhere and is a rather heavy user of
reflection. Deprecate it for removal.

JIRA: MDSAL-802
Change-Id: If3f94622b9ae11b8f63f4d93e3ee211d456725f8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
17 months agoDeprecate BindingReflections.getModelRootPackageName() 64/103664/2
Robert Varga [Tue, 13 Dec 2022 16:22:17 +0000 (17:22 +0100)]
Deprecate BindingReflections.getModelRootPackageName()

This implementation is a pure mapping thing, hence it has nothing
to do with reflection. Introduce the same method in BindingMapping
and deprecate old methods for removal.

JIRA: MDSAL-800
Change-Id: I598807e481db629e6c12380271ca160430b5fa66
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
17 months agoDeprecate WriteTransaction.mergeParentStructure*() 37/103637/1
Robert Varga [Thu, 8 Dec 2022 22:09:13 +0000 (23:09 +0100)]
Deprecate WriteTransaction.mergeParentStructure*()

These methods hark to our dark past. Most of their uses should be
superfluous with current semantics and they paper over important
lifecycle management questions. Furthermore there are corner cases for
which they cannot be made to work simply because of the semantics
involved.

Deprecate these method so their users are pointed out and can be
gradually migrated.

Change-Id: Ib85d42a9514b33fcdb1efb1ddb273b4c6ee0e554
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
17 months agoFix union/bits string mapping 03/103603/1
Robert Varga [Mon, 5 Dec 2022 17:50:10 +0000 (18:50 +0100)]
Fix union/bits string mapping

BitsTypeObject changed the name of the value getter -- it is now
values(), not getValue(). Adjust UnionTemplate reference and update
tests to covert this case.

JIRA: MDSAL-797
Change-Id: I8b8789b87ae5ea43eaa942b932690dc3e35a161e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
17 months agoSet Xtend generation target to Java 17 74/103574/1
Robert Varga [Sun, 4 Dec 2022 17:59:36 +0000 (18:59 +0100)]
Set Xtend generation target to Java 17

Xtend can now support Java 17, let's use it.

Change-Id: I3135f893b89e453af2a13abd67e1fde59fd0ac5c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
17 months agoBump Xtend to 2.29.0 73/103573/1
Robert Varga [Sun, 4 Dec 2022 17:59:09 +0000 (18:59 +0100)]
Bump Xtend to 2.29.0

Pick up latest upgrade.

Change-Id: Ie5d3c7e508b6e2886c55985ea5e4e5c46c61f722
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
17 months agoBump versions to 11.0.3-SNAPSHOT 69/103569/1
Robert Varga [Sun, 4 Dec 2022 14:37:14 +0000 (15:37 +0100)]
Bump versions to 11.0.3-SNAPSHOT

This starts the next development iteration.

Change-Id: I4a8f80b45a971542dd1ca5d0a696b26b60118b71
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
17 months agoBump yangtools to 10.0.2 68/103568/1
Robert Varga [Sun, 4 Dec 2022 14:31:49 +0000 (15:31 +0100)]
Bump yangtools to 10.0.2

Pick up the fix for XML parser regression.

Change-Id: Idd5789f19ae3925e12950a8cf51a5901370bcb96
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoBump versions to 11.0.2-SNAPSHOT 43/103443/1
Robert Varga [Mon, 28 Nov 2022 17:08:45 +0000 (18:08 +0100)]
Bump versions to 11.0.2-SNAPSHOT

This starts the next development iteration.

Change-Id: I7a2367609de91fe1d2231ee3c8f48fe6851387ba
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoFix AbstractDOMRoutingTable.{add,remove}All() 42/103442/4
Robert Varga [Mon, 28 Nov 2022 13:15:17 +0000 (14:15 +0100)]
Fix AbstractDOMRoutingTable.{add,remove}All()

Our naive implementation breaks down if we are registering multiple
items, as we end up adding unmodified entries each and every time.

Fix this up by decomposing identifiers in the caller, keeping them in a
table and then have addAll()/removeAll() work on the table, with careful
checks.

JIRA: MDSAL-796
Change-Id: I0a52763e047026c1a641d9a25d82ee1d193fd573
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoMake invertImplementationsMap() static 39/103439/1
Robert Varga [Mon, 28 Nov 2022 10:42:41 +0000 (11:42 +0100)]
Make invertImplementationsMap() static

This method is not touching staste, make it static to make that clear.

Change-Id: I1c6366c3f36bae4a8b77c84edeea9e8770eae968
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoRefactor createDomRpcIdentifiers() 25/103425/2
Robert Varga [Sat, 26 Nov 2022 15:32:05 +0000 (16:32 +0100)]
Refactor createDomRpcIdentifiers()

We are creating a temporary HashMap, there is just no need to do that,
and we can further de-duplicate callers by introducing register()
which registered a transformed map.

Change-Id: I6ac52eb9b383ebfefc790596cdbb92ce418871a8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoSimplify transactionAborted() 10/103410/3
Robert Varga [Sat, 26 Nov 2022 09:22:30 +0000 (10:22 +0100)]
Simplify transactionAborted()

We have introduced instanceof patterns, which simplify the structure
enough so Sonar points out we should merge if statements. Do that and
inline 'success' as well.

Change-Id: I23bc76a3abe26b25d534e6a22f8b672310f987c1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoModernize AbstractIetfInetUtil 11/103411/4
Robert Varga [Sat, 26 Nov 2022 09:36:55 +0000 (10:36 +0100)]
Modernize AbstractIetfInetUtil

Centralize thrown exceptions, inline the checks and use switch
expressions. This should make Sonar happier.

Change-Id: Ibc71439eb8ebe4f8b7f60d018b70d2e255bdcfb0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoEnable HTML linting 07/103407/2
Robert Varga [Sat, 26 Nov 2022 09:01:17 +0000 (10:01 +0100)]
Enable HTML linting

We require JDK17, hence we can properly lint HTML.

Change-Id: Ie845b23530f96f5ab3ee3eacae42734b0f754281
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoUse explicit exceptions in benchmark 09/103409/1
Robert Varga [Sat, 26 Nov 2022 09:19:04 +0000 (10:19 +0100)]
Use explicit exceptions in benchmark

Sonar does not like Exception, fix the issues reported.

Change-Id: I483b4bb04839f577261f4a141ddfc0dd8b90b08a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoLog timeouts 08/103408/2
Robert Varga [Sat, 26 Nov 2022 09:06:59 +0000 (10:06 +0100)]
Log timeouts

Sonar is complaining about TimeoutException, log them.

Change-Id: Ia3f33fb5f66b7bba71763e281172184c56b46394
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoUse RpcEffectiveStatement.input() 06/103406/1
Robert Varga [Sat, 26 Nov 2022 07:54:00 +0000 (08:54 +0100)]
Use RpcEffectiveStatement.input()

This saves a bit of code.

Change-Id: I77c482b6566fb4cb5102eae8ab84999f4d9ad083
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoBump versions to 11.0.1-SNAPSHOT 02/103402/1
Robert Varga [Fri, 25 Nov 2022 16:44:54 +0000 (17:44 +0100)]
Bump versions to 11.0.1-SNAPSHOT

This starts the next development iteration.

Change-Id: Ia40325bfd0a3da4de33c05f8484f1e24c80204e5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoBump upstream versions 01/103401/1
Robert Varga [Fri, 25 Nov 2022 15:46:44 +0000 (16:46 +0100)]
Bump upstream versions

Adopt:
- odlparent-12.0.1
- yangtools-10.0.1

Change-Id: I376c482c8c050a14a3de94c4768cad2c01320e1e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoFix a module warning 84/103384/2
Robert Varga [Fri, 25 Nov 2022 02:43:32 +0000 (03:43 +0100)]
Fix a module warning

We are exposing javax.inject-annotated class, user should therefore
know about javax.inject (although there should not be any).

Change-Id: I076f82b9921b00d9483703f684277512e565d33e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoImprove SchemaUnawareCodec 83/103383/2
Robert Varga [Fri, 25 Nov 2022 02:36:09 +0000 (03:36 +0100)]
Improve SchemaUnawareCodec

Propagate type safety a bit and reduce casts a bit.

JIRA: MDSAL-743
Change-Id: I05a727f9eb21f55f41c84b3dd5bb264aefd71a73
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoClean up AbstractCompositeGenerator 81/103381/1
Robert Varga [Fri, 25 Nov 2022 02:08:11 +0000 (03:08 +0100)]
Clean up AbstractCompositeGenerator

Sonar is pointing out foldable ifs, compress them thoroughly with
instanceof patterns.

Change-Id: I8c7ce9bed79dbc3338a526f4fe0337df712ead50
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoClean up SchemaRootCodecContext 80/103380/1
Robert Varga [Fri, 25 Nov 2022 02:02:55 +0000 (03:02 +0100)]
Clean up SchemaRootCodecContext

We have a few warnings from Sonar, perform general modernization.

Change-Id: Id817e176a8968afacbc4bdd7c56f25b7240af370
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoClean up IdentifiableItemCodec 79/103379/1
Robert Varga [Fri, 25 Nov 2022 01:53:00 +0000 (02:53 +0100)]
Clean up IdentifiableItemCodec

Sonar reports a few issues, clean the class up.

Change-Id: Ibc6f8794444369d976dce216c835a517f99f4d1f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoClean up EncapsulatedValueCodec 78/103378/1
Robert Varga [Fri, 25 Nov 2022 01:34:54 +0000 (02:34 +0100)]
Clean up EncapsulatedValueCodec

Sonar is pointing out a number of issues, clean them up, although
most are false positives.

Change-Id: Ie04d42a902c6d6ee6037ba6e105205cf308c36dd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoCentralize AbstractDOMRpcImplementationAdapter.serialize() 70/103370/4
Robert Varga [Thu, 24 Nov 2022 23:40:13 +0000 (00:40 +0100)]
Centralize AbstractDOMRpcImplementationAdapter.serialize()

The invocation paths between the two specializations are exactly the
same, hence we can peel arguments and just pass down the input. Also
fixup duplicate access to serializer.

JIRA: MDSAL-86
Change-Id: I2df5061b47c63cd2886efdacfe5178acc08239de
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoTighten AbstractDOMRpcImplementationAdapter.serialize() 69/103369/2
Robert Varga [Thu, 24 Nov 2022 21:28:12 +0000 (22:28 +0100)]
Tighten AbstractDOMRpcImplementationAdapter.serialize()

Require non-null arguments and make sure to return RpcInput, as that
what we need. Allows us to tighten up the legacy method handle as well.

JIRA: MDSAL-86
Change-Id: I76b6bc5707babcd2d71c1349672daf750999c998
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoEliminate RpcMethodInvoker 68/103368/2
Robert Varga [Thu, 24 Nov 2022 21:18:24 +0000 (22:18 +0100)]
Eliminate RpcMethodInvoker

RpcMethodInvoker is a useless indirection around a MethodHandle with
a known signature. Eliminate this indirection and cache all
MethodHandles for a particular Rpc, passing each of them the its
individual LegacyDOMRpcImplementationAdapter.

This allows LegacyDOMRpcImplementationAdapter to fuse the delegate
object into its internal MethodHandle -- hence we do not need to track
the delegate separately.

JIRA: MDSAL-86
Change-Id: I9b89d353fc61e313c82e997ffeddbbb473bbd07f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoRegister multiple LegacyDOMRpcImplementationAdapters 67/103367/1
Robert Varga [Thu, 24 Nov 2022 20:39:07 +0000 (21:39 +0100)]
Register multiple LegacyDOMRpcImplementationAdapters

We have created all the building blocks for being able to remove
binding dispatch during method invocation -- we already have a 1:1
BindingDOMRpcImplementationAdapter to bridge to a Rpc.invoke().

There we can perform the same binding here -- and register multiple
legacy adapters, each servicing one method.

JIRA: MDSAL-86
Change-Id: Ifacaf5f61b73a0a7f0870477dac295b2d5a04287
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoEliminate RpcServiceInvokers 66/103366/1
Robert Varga [Thu, 24 Nov 2022 20:10:46 +0000 (21:10 +0100)]
Eliminate RpcServiceInvokers

RpcServiceInvokers are a useless indirection, really, as we can get
by with a simple map. This is not yet perfect, as we really want to
eliminate the lookup map completely.

JIRA: MDSAL-86
Change-Id: I6e95bfd979c4862799ea51915c6ca46f69cbe379
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoUnify RPC input serialization 65/103365/2
Robert Varga [Thu, 24 Nov 2022 19:28:36 +0000 (20:28 +0100)]
Unify RPC input serialization

We know the expected RPC QName, hence we can share code between the
two implementations.

Change-Id: I9e071d329b441509a6747495ab6d9d3573796ff5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoRehost getRpcMethodToQName() 64/103364/2
Robert Varga [Thu, 24 Nov 2022 18:40:06 +0000 (19:40 +0100)]
Rehost getRpcMethodToQName()

This methods is only used by BindingDOMRpcProviderServiceAdapter,
move it there.

Change-Id: I676b7254386f15a447b753af01d5f71f1e15fa3b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoLegacyDOMRpcImplementationAdapter is generic 63/103363/1
Robert Varga [Thu, 24 Nov 2022 18:13:55 +0000 (19:13 +0100)]
LegacyDOMRpcImplementationAdapter is generic

We are bridging to a well-defined RpcService subclass, hence this
should be captured in the field type -- making the class generic.

Change-Id: I46019e6e821a798474f639737c6fefe199bae8ee
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoRemove BindingReflections.resolveRpc{In,Out}putClass() 21/103021/6
Robert Varga [Wed, 2 Nov 2022 14:50:44 +0000 (15:50 +0100)]
Remove BindingReflections.resolveRpc{In,Out}putClass()

These methods are not used anywhere, remove them.

JIRA: MDSAL-788
Change-Id: I3ab399500e28c4cc446ab24b55080c2d4aa8af60
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoCentralize "invoke" string definition 36/103336/4
Robert Varga [Wed, 23 Nov 2022 17:59:38 +0000 (18:59 +0100)]
Centralize "invoke" string definition

We have "invoke" in three places and it needs to be tied to the actual
definition. Introduce two constants in BindingMapping to perform that
job and link RPC/Action adapters to those constants.

Change-Id: If6c8f43e266d2a4395eb5237578803c23125d21d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoDeprecate RpcService 61/102661/16
Robert Varga [Thu, 13 Oct 2022 09:17:50 +0000 (11:17 +0200)]
Deprecate RpcService

We have single-RPC generated interfaces, which are easier to use than
the RpcService-based roll-up. This patch deprecates all RPC interfaces
pending their removal.

JIRA: MDSAL-778
Change-Id: Iac537de518725173f21369ab0e04fb44fb0506b7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoAdd support for registering single-RPC services 78/102578/34
Robert Varga [Thu, 6 Oct 2022 11:47:52 +0000 (13:47 +0200)]
Add support for registering single-RPC services

We are currently providing an aggregated RpcService generated class,
which is binding the invocation model to that class -- without the
ability to provide an implementation of a single RPC. It also
complicates the invocation path from DOM, since we need to perform
two lookups: one in DOM, where we route the invocation towards the
RpcServiceAdapter and then a method-based lookup to dispatch it in
the proxy.

Furthermore this prevents the possibility of adapting the invocation
contract, as the codegen is always involved.

We are now generating interfaces representing individual RPCs, just like
we do for actions. This provides a more granular access and notably
allows mdsal-binding-api to provide invocation contract adapters -- thus
disconnecting it from codegen.

JIRA: MDSAL-777
Change-Id: I114bd3795ba353da57e7f96d5db9680986ecb5f6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoChange action input/output naming strategy 60/103360/3
Robert Varga [Thu, 24 Nov 2022 16:14:54 +0000 (17:14 +0100)]
Change action input/output naming strategy

Users may want to implement multiple actions in a single source file, to
which extent the placement and bare names of Input and Output are rather
bad -- they cannot be imported more than once, leading to clutter.

RPC input/output do not suffer from this, as they combine their names
with the name of the RPC -- leading to to classes which can easily be
imported.

JIRA: MDSAL-794
Change-Id: I59e9926d7c5504519e9c9ba43c6915f6e5808ad6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoClean up BindingDOMAdapterLoaderTest 59/103359/2
Robert Varga [Thu, 24 Nov 2022 16:57:43 +0000 (17:57 +0100)]
Clean up BindingDOMAdapterLoaderTest

We have @Test(expected=) here as well as nulls which are not allowed.
Clean up the entire test.

Change-Id: Ie1774401adceed35d519de8f6d844096a6ee8798
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoClean up ContextReferenceExtractor a bit 55/103355/2
Robert Varga [Thu, 24 Nov 2022 15:42:50 +0000 (16:42 +0100)]
Clean up ContextReferenceExtractor a bit

Both implementations are operating on MethodHandles, which brings
Throwable into the picture. Move the common try/catch block into
the abstract class, reducing code duplication a bit.

Change-Id: I549ab704b6c1d1f3c0d9e4a1ac66b5dd9ecedaf7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoTighten up RpcInvocationStrategy 35/103335/2
Robert Varga [Wed, 23 Nov 2022 16:36:36 +0000 (17:36 +0100)]
Tighten up RpcInvocationStrategy

The invoke path is always taking RpcInput, make sure we cast it that
way, preventing potential confusion.

Change-Id: I8ec00eb4b4074b60b36abfe57948806a11634aad
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoConnect ContextReferenceExtractor with BindingMapping 34/103334/2
Robert Varga [Wed, 23 Nov 2022 15:58:02 +0000 (16:58 +0100)]
Connect ContextReferenceExtractor with BindingMapping

The "getValue" magic string is well documented, make sure to reference
it in its BindingMapping form.

Change-Id: If152de3145f6821a6b83715a3232da8092ff6d73
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoSeal ContextReferenceExtractor 33/103333/2
Robert Varga [Wed, 23 Nov 2022 15:35:11 +0000 (16:35 +0100)]
Seal ContextReferenceExtractor

Now that we have the pesky anonymous null implementation out of the way,
we can seal ContextReferenceExtractor, codifying there are only two
possible implementations -- since they are utterly simple, also move
them into ContextReferenceExtractor.java.

Change-Id: I7eb592316cc91baba3fe803eef3ff52682b2ac26
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoRework ContextReferenceExtractor caching 32/103332/2
Robert Varga [Wed, 23 Nov 2022 15:23:34 +0000 (16:23 +0100)]
Rework ContextReferenceExtractor caching

Rather than instantiating a weak global cache, cache
ContextReferenceExtractors in CurrentAdapterSerializer based on
JavaTypeName. This allows us to remove BindingReflections from the
instantiation path.

Since we are mucking around with this, also eliminate the null
extractor, which means we end up falling back to stock-normal invocation
strategy -- removing an unneeded indirection.

JIRA: MDSAL-777
Change-Id: Ic5e1f5a9da399a2ae2e93d549c6056a0067a6bcd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoBreak open RpcInvocationStrategy 31/103331/2
Robert Varga [Wed, 23 Nov 2022 14:50:00 +0000 (15:50 +0100)]
Break open RpcInvocationStrategy

Creation of the strategy is inter-twined with ContextReferenceExtractor,
which we want to cache in CurrentAdapterSerializer. Inline creation of
the strategy where we have controlled access to
CurrentAdapterSerializer, with RpcServiceAdapter doing the mediation, so
that we do not pass things around and create a method call tangle.

JIRA: MDSAL-777
Change-Id: I3f092f8ce47d154c84ca821512d1fbfbb65d8673
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoIntegrate getRpcMethodToSchema() into constructor 30/103330/2
Robert Varga [Wed, 23 Nov 2022 14:36:34 +0000 (15:36 +0100)]
Integrate getRpcMethodToSchema() into constructor

We are creating an intermediate map here, only to re-examine it in a
second pass. Integrate the method and create rpcNames in a single pass.
This gives us a more direct conduit to RpcInvocationStrategy.

JIRA: MDSAL-777
Change-Id: I63c6a6d108e9336fcca56343652b9695ae3d4992
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoMove getRpcMethodToSchema() 29/103329/3
Robert Varga [Wed, 23 Nov 2022 14:26:58 +0000 (15:26 +0100)]
Move getRpcMethodToSchema()

This method is only used by RpcServiceAdapter and depends only on
BindingRuntimeContext. Move it to RpcServiceAdapter to improve
containment.

JIRA: MDSAL-777
Change-Id: Ib4222bb85214d27d82feec17fc8c91809ebe44de
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoUpdate CurrentAdapterSerializer.getRpcMethodToSchema() 27/103327/3
Robert Varga [Wed, 23 Nov 2022 13:18:33 +0000 (14:18 +0100)]
Update CurrentAdapterSerializer.getRpcMethodToSchema()

We are moving less reliance on BindingReflections and RpcDefinition.
Refactor getRpcMethodToSchema() to use RpcRuntimeTypes instead, from
whence we can acquire better information -- for example
RpcEffectiveStatement.

Also update LazySerializedContainerNodeTest to not rely on this method,
as it can get its inputs in a much smoother manner.

This is another step to eliminating BindingReflections from invocation
strategy creation, which we will need, as single RPCs just do not have
the type capture we need for the input class.

JIRA: MDSAL-777
Change-Id: I7382e2a01ee8ee0d0e611286f9dcef5d92e6acdf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoClean up RpcServiceAdapter 21/103321/5
Robert Varga [Wed, 23 Nov 2022 00:30:06 +0000 (01:30 +0100)]
Clean up RpcServiceAdapter

Deal with the proxy naming conflict, removing a CheckStyle suppression.
Also use local variable type inference to shorten things a bit.

JIRA: MDSAL-777
Change-Id: Ie0cebd4dac3c714060af5683671b1cafd164f00e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoSplit out RpcInvocationStrategy 20/103320/4
Robert Varga [Wed, 23 Nov 2022 00:18:43 +0000 (01:18 +0100)]
Split out RpcInvocationStrategy

The invocation strategy will need to be shared with single-RPC proxies.
Split it out, seal it and make sure to clean it up. This ends up
eliminating one class, as the usual case is easily handled and then only
overridden for content-routed RPCs.

JIRA: MDSAL-777
Change-Id: If5f25617fa3120405d0872ded229cdd7db99065a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoMove BindingReflections.isSubstitutionFor() 49/103349/2
Robert Varga [Thu, 24 Nov 2022 13:38:08 +0000 (14:38 +0100)]
Move BindingReflections.isSubstitutionFor()

We have deprecated this method, now move it to its sole user.

Change-Id: Id596e9cea546264e848b302a73ba3bb4e82faee7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoDeprecate BindingReflections.isSubstitutionFor() 48/103348/2
Robert Varga [Thu, 24 Nov 2022 13:34:40 +0000 (14:34 +0100)]
Deprecate BindingReflections.isSubstitutionFor()

This method is used only in mdsal-binding-dom-codec, deprecate it for
removal.

Change-Id: I188f0d14b10f72bce2561c6e80e087a230eb5b4b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoHide BindingReflections.isNotification() 45/103345/4
Robert Varga [Thu, 24 Nov 2022 12:05:38 +0000 (13:05 +0100)]
Hide BindingReflections.isNotification()

This method is not used anywhere, remove it from public sight.

JIRA: MDSAL-781
Change-Id: I3d188db0d4622efdba0782656b0884d70540ae36
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoDeprecate BindingReflections.isNotification() 44/103344/3
Robert Varga [Thu, 24 Nov 2022 12:04:36 +0000 (13:04 +0100)]
Deprecate BindingReflections.isNotification()

This methods is only used internally and in tests, deprecate it for
removal.

Change-Id: I1c4b5b863c20caa5056a5db505921ff512cdeba8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoGenerate binding-dom-codec classes into separate packages 22/103322/5
Ruslan Kashapov [Wed, 23 Nov 2022 06:05:12 +0000 (08:05 +0200)]
Generate binding-dom-codec classes into separate packages

We are namespace-squatting on the codegen namespace, adding various
magic suffixes to ensure uniqueness. This is not perfect, because
compile-time codegen does not have a completely free reign over
its namespace. This is also problematic if these classes were delivered
through a separate jar -- it would cause split packages, which are
ugly.

Allocate three new namespaces and dump codec classes there, thus
ensuring no overlap, squatting or similar.

JIRA: MDSAL-784
Change-Id: I68b8db09ffc9286bb40118545619760b9060a082
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoMove BindingReflections.getChildrenClass* 40/103340/2
Robert Varga [Thu, 24 Nov 2022 10:23:21 +0000 (11:23 +0100)]
Move BindingReflections.getChildrenClass*

These methods are only used by mdsal-binding-dom-codec, move them to
their sole users.

JIRA: MDSAL-781
Change-Id: I074a8c91f1729194f47310424dd93a9e703ca629
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoDeprecate BindingReflections.getChildrenClass* 41/103341/1
Robert Varga [Thu, 24 Nov 2022 11:38:23 +0000 (12:38 +0100)]
Deprecate BindingReflections.getChildrenClass*

These methods are only used by mdsal-binding-dom-codec, deprecate them.

Change-Id: I9ba5a82bfab437640c76625a316e60c4902099fc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoDeprecate BindingReflections.resolveRpc{In,Out}putClass() 20/103020/6
Robert Varga [Wed, 2 Nov 2022 14:47:59 +0000 (15:47 +0100)]
Deprecate BindingReflections.resolveRpc{In,Out}putClass()

These methods are not used anywhere, deprecate them.

Change-Id: I10cd81e4a52f52edcbcb1cb0be5621270633e9a9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoUpdate {Leaf,Root}BindingClassLoader 38/103338/7
Robert Varga [Thu, 24 Nov 2022 01:41:19 +0000 (02:41 +0100)]
Update {Leaf,Root}BindingClassLoader

Use a VarHandle so we can reduce volatile loads a bit. Also use
ImmutableSet.builder() fluently, eliminating an intermediate ArrayList.

Change-Id: I1ab2806db6ddd7482110826c96bf3d9b88d6d28c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoSplit out mdsal-binding-loader 37/103337/6
Robert Varga [Thu, 24 Nov 2022 00:50:45 +0000 (01:50 +0100)]
Split out mdsal-binding-loader

The class loader based on ByteBuddy is more generally useful, split it
out into a separate artifact for reuse.

Also rename CodecClassLoader to BindingClassLoader, as that is more
appropriate. Modernize the code a bit by using local variable type
inference. Furthermore drop dependency on Guava's Supplier, as we can
achieve the same with java.util.function.Supplier.

JIRA: MDSAL-793
Change-Id: I3630e452ed631c11cd0ea62b1d790bec360baf4a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoRefactor RpcRoutingStrategy 13/103313/2
Robert Varga [Mon, 21 Nov 2022 18:47:31 +0000 (19:47 +0100)]
Refactor RpcRoutingStrategy

RpcRoutingStrategy is not really a nice construct -- it essentially
extracts context information, not much more. As such, dealing with two
subclasses is a drag.

Intruduce ContentRoutedRpcContext to capture the interesting information
in a record and adjust users to deal with the fact that normal RPCs do
not have this construct.

Change-Id: I2c8d24a61e6905063c9eb93fb0513dffe4831b66
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoDerive RpcRoutingStrategy from RpcEffectiveStatement 06/103306/2
Robert Varga [Mon, 21 Nov 2022 13:10:39 +0000 (14:10 +0100)]
Derive RpcRoutingStrategy from RpcEffectiveStatement

Use RpcEffectiveStatement instead of RpcDefinition to derive the
strategy. A knock-on effect is a clean up of entries and their tests,
as they can operate solely on QNames now.

Change-Id: Id2988458bb923d09b07a5a1819554b043b3840d8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoSeal RpcRoutingStrategy 05/103305/2
Robert Varga [Mon, 21 Nov 2022 13:01:04 +0000 (14:01 +0100)]
Seal RpcRoutingStrategy

We do not allow subclassing of this class, make sure to codify that by
sealing it.

Change-Id: I6edea76dec0511bc16e94a06b4aee2be894732b7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoAdd RpcProviderService documentation 01/103301/1
Robert Varga [Sun, 20 Nov 2022 18:42:38 +0000 (19:42 +0100)]
Add RpcProviderService documentation

We have largely-undocumented methods. Add documentation.

Change-Id: I7b12ba2d412d6de276e4c62277ff3c852e72a996
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoRename Enumeration to EnumTypeObject 98/103298/1
Robert Varga [Fri, 18 Nov 2022 01:21:02 +0000 (02:21 +0100)]
Rename Enumeration to EnumTypeObject

Enumeration is a troublesome name, let's use a more regular
EnumTypeObject, which follows the TypeObject naming.

Change-Id: I2581d760db8597f7ccfe6f0d2c68e28423fbea5d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoAdd UnionTypeObject 97/103297/2
Robert Varga [Thu, 17 Nov 2022 22:56:36 +0000 (23:56 +0100)]
Add UnionTypeObject

Introduce UnionTypeObject, which is a specialization of TypeObject to
unions. This allows us to seal TypeObject, making sure all it is always
properly specialized.

Also revert the change in SerialVersionUID introduced with
BitsTypeObject by properly ignoring it.

Change-Id: I72ef1d452e2a48c630e9c87bfb4ff0fac0fda32c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoAdd BitsTypeObject 40/101840/30
Ivan Martiniak [Tue, 12 Jul 2022 09:18:39 +0000 (11:18 +0200)]
Add BitsTypeObject

The new interface BitsTypeObject, besides grouping bits type objects,
helps clarify which bits are restricted.

Method validValues() returns constant containing valid bits.
The logic of the creation of this constant is contained in the
AbstractTypeObjectGenerator.java.
Method getValue() was included in this interface and its generation
was adjusted for restricted and standard bits types separately.

Related test classes were adjusted as well.

JIRA: MDSAL-743
Change-Id: I74820e7a041e137902c774655517ea8d1e4bccd9
Signed-off-by: Ivan Martiniak <ivan.martiniak@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoBump byte-buddy to 1.12.19 96/103296/1
Robert Varga [Thu, 17 Nov 2022 22:33:46 +0000 (23:33 +0100)]
Bump byte-buddy to 1.12.19

https://github.com/raphw/byte-buddy/releases/tag/byte-buddy-1.12.14
https://github.com/raphw/byte-buddy/releases/tag/byte-buddy-1.12.15
https://github.com/raphw/byte-buddy/releases/tag/byte-buddy-1.12.16
https://github.com/raphw/byte-buddy/releases/tag/byte-buddy-1.12.17
https://github.com/raphw/byte-buddy/releases/tag/byte-buddy-1.12.18
https://github.com/raphw/byte-buddy/releases/tag/byte-buddy-1.12.19

Change-Id: Iff0bf7fac38abb69cb8d1547e8fa188a11428b94
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoImprove SerialVersionHelper a bit 89/103189/3
Robert Varga [Thu, 10 Nov 2022 01:27:47 +0000 (02:27 +0100)]
Improve SerialVersionHelper a bit

sortedCollection() can use local variable type inference, which ends up
binding ArrayList.sort() directly -- providing a smidge better
performance by using INVOKEVIRTUAL instead of INVOKEINTERFACE.

Change-Id: I28470942dc37dd8171cc10eccf6c6a15d85ade9e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoDo not use appendValue to append bits 88/103188/2
Robert Varga [Thu, 10 Nov 2022 01:09:41 +0000 (02:09 +0100)]
Do not use appendValue to append bits

Using false/true values is overly verbose and incurs a boxing penalty.
Update mapping to only mention bits which are set. Add a dedicated
CodeHelpers.appendBit(), which uses boolean value to decide whether to
append the bit's name or not.

JIRA: MDSAL-744
Change-Id: Ifefa258dc6850ea220ffebcc7dbb788979657704
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoUse Boolean.hashCode() for bits components 86/103186/1
Robert Varga [Thu, 10 Nov 2022 00:36:32 +0000 (01:36 +0100)]
Use Boolean.hashCode() for bits components

Rather than boxing to Boolean and then going through
Objects.hashCode(Object), employ some smarts and go directly to
Boolean.hashCode(boolean).

JIRA: MDSAL-744
Change-Id: Ida374207c67b776e1eeafb40e3a4f725fe2edf1f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoUse primitive comparison for bit properties 85/103185/3
Robert Varga [Wed, 9 Nov 2022 23:40:15 +0000 (00:40 +0100)]
Use primitive comparison for bit properties

Rather than boxing to go through Objects.equals(), use plain '==' on
booleans.

JIRA: MDSAL-744
Change-Id: I005ba52d8c68fb9eaf7d93e40adcf13ca159436f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoRemove BaseTemplate.hashCodeResult() 84/103184/1
Robert Varga [Wed, 9 Nov 2022 22:59:09 +0000 (23:59 +0100)]
Remove BaseTemplate.hashCodeResult()

This method is not used anywhere, remove it.

Change-Id: I7c17303b08443c67eaf321ff5c316ebb991351ec
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoImprove class template equals() 83/103183/1
Robert Varga [Wed, 9 Nov 2022 22:53:46 +0000 (23:53 +0100)]
Improve class template equals()

Rather than generating a slew of if/return statements, use instanceof
pattern and generate a single-expression return statement.

Change-Id: Id8c0fc65736399fed3454fdbcc16a16849f86064
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoImport java.lang.Object in equals() 82/103182/1
Robert Varga [Wed, 9 Nov 2022 22:19:32 +0000 (23:19 +0100)]
Import java.lang.Object in equals()

We have the machinery to have a proper reference, let's use it.

Change-Id: I92e08cac810c3c3f7a3a737746d6c85ba5f2c10e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoMap bits type to primitive boolean 73/101673/16
ivan.martiniak [Fri, 1 Jul 2022 11:31:41 +0000 (13:31 +0200)]
Map bits type to primitive boolean

The main change is in the AbstractTypeObjectGenerator.java,
returned type for bits was set to primitive boolean.
Generation of the getDefaultInstance() method in the ClassTemplate.xtend
had to be adjusted as well, as the null value obviously
does not make sense in the case of primitive type.
Related test classes had to be changed as well

JIRA: MDSAL-744
Change-Id: Ic6423f67679475fced73ea68ed4f447b241230f7
Signed-off-by: ivan.martiniak <ivan.martiniak@pantheon.tech>
18 months agoMake SerializedDOMDataBroker final 27/103127/2
Robert Varga [Mon, 7 Nov 2022 16:10:43 +0000 (17:10 +0100)]
Make SerializedDOMDataBroker final

This is a utility implementation and it should not be subclassed.

Change-Id: Ie69f01bd232ae1a407f332235c800b655a186499
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoDo not emit empty super() call 79/103179/1
Robert Varga [Wed, 9 Nov 2022 18:31:48 +0000 (19:31 +0100)]
Do not emit empty super() call

If we do not have any parent properties, we should not generate a
free-standing super() call -- javac will do that for us.

Change-Id: Ib45ec29e9914f0f3eeef7e2d86ebb94fbd33aab1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoKeep property initialization order constant 78/103178/1
Robert Varga [Wed, 9 Nov 2022 18:24:55 +0000 (19:24 +0100)]
Keep property initialization order constant

Eventhough one property is checked for null, we should not be placing it
before the others.

Change-Id: I2be23b4ed278d693828a1758af9c47b0a6e0caf9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoRequire union field to be set 76/103176/2
Robert Varga [Wed, 9 Nov 2022 18:05:46 +0000 (19:05 +0100)]
Require union field to be set

Do not allow an union type object to be costructed without supplying one
of its alternatives.

JIRA: MDSAL-792
Change-Id: I69a9dc3f0094cc9ff03d0846d5f9dcc746417628
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoMigrate mdsal-binding-test-model to JUnit 5 77/103177/2
Robert Varga [Wed, 9 Nov 2022 18:11:21 +0000 (19:11 +0100)]
Migrate mdsal-binding-test-model to JUnit 5

We have a few simple tests, let's migrate them.

Change-Id: Ifea435affc917070a20d3ca9368d6d3c7f499453
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoDo not allow multi-datastore transactions 42/95242/44
Robert Varga [Sun, 21 Feb 2021 12:15:35 +0000 (13:15 +0100)]
Do not allow multi-datastore transactions

Cross-datastore transactions are something that does not fit into
interaction model of neither MD-SAL nor NETCONF WG. As we are evolving
our APIs to make them impossible, make sure we report attempts to use
transactions across multiple datastore.

JIRA: MDSAL-775
Change-Id: If9a3bb619f4fd5703f786d14f42485d2073968ec
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoUse a VarHandle for closed flag 20/103120/3
Robert Varga [Mon, 7 Nov 2022 01:56:16 +0000 (02:56 +0100)]
Use a VarHandle for closed flag

This eliminates type safety warnings and make it more explicit as to
what we mean.

Change-Id: Ib268de2c02c7ac04aec25a3a1f9df40d2b8c3238
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoImprove AbstractDOMForwardedTransactionFactory 21/103121/1
Robert Varga [Mon, 7 Nov 2022 01:58:21 +0000 (02:58 +0100)]
Improve AbstractDOMForwardedTransactionFactory

AutoCloseable.close() is recommended to be idempotent, follow that
guidance, producing a warning with a stack trace if that is not the
case.

Change-Id: I0ba827bae521b07c94ecf58e8881f72b1ec8fdc6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoSpecialize CommitCoordinationTask 18/103118/2
Robert Varga [Mon, 7 Nov 2022 01:11:11 +0000 (02:11 +0100)]
Specialize CommitCoordinationTask

Tracker is optional, so let's subclass the tracking into a wrapper
class.

Change-Id: I4271d2453181bbbf2310c4737ef90b87d154b046
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoRemove OSGiQueryFactory 11/103111/3
Robert Varga [Sun, 6 Nov 2022 20:13:43 +0000 (21:13 +0100)]
Remove OSGiQueryFactory

We have constructor injection, so let's do that. Also activate lazily
and therefore lower debug levels.

Change-Id: I0b37a2bab8109d47d13276b135b7f510272ee024
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoUse a record for RecordId 10/103110/2
Robert Varga [Sun, 6 Nov 2022 20:14:55 +0000 (21:14 +0100)]
Use a record for RecordId

This is pure data holder, use a record instead.

Change-Id: I1161e0431592f15360c6cdd87e37604bb0fbc2e0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoFixup AbstractForwardedTransaction.doExecute() 12/103112/2
Robert Varga [Sun, 6 Nov 2022 20:22:47 +0000 (21:22 +0100)]
Fixup AbstractForwardedTransaction.doExecute()

This should be a static method, also modernize it a bit.

Change-Id: Iecea13d78146c235dea389f1e72543751ed255fb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoRename ModuleInfoSnapshotResolver 83/103083/2
Robert Varga [Fri, 4 Nov 2022 16:40:54 +0000 (17:40 +0100)]
Rename ModuleInfoSnapshotResolver

We are masquerading as the binding-dom-codec, but that is not accurate.
Use our name instead.

Change-Id: I930976e96b22bbb070d1a02ccd28bfa86a59cf1e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoModernize ModuleInfoSnapshotResolver a bit 84/103084/2
Robert Varga [Fri, 4 Nov 2022 17:18:56 +0000 (18:18 +0100)]
Modernize ModuleInfoSnapshotResolver a bit

Use local variable type inference and streams to transform things.
This reduces the verboseness a bit.

Change-Id: I9ec9bf70c7f90b4cd264e9f239b96ddff60bc0cc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoSimplify YangModuleInfoScanner 82/103082/2
Robert Varga [Fri, 4 Nov 2022 16:36:45 +0000 (17:36 +0100)]
Simplify YangModuleInfoScanner

We will be tracking YangFeatureProviders, so
List<ObjectRegistration<YangModuleInfo>> is not quite accurate. Track
only a simple Registration and make sure we wrap the return from
ModuleInfoSnapshotResolver.

Also improve the tracking logic a bit: do not track bundles which do not
contain YangModuleInfos, but make a special exception for the system
bundle.

JIRA: MDSAL-791
Change-Id: I245f25c72152f7e49817c316f63ace557b4c56c0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoRemove unneeded suppression 81/103081/1
Robert Varga [Fri, 4 Nov 2022 16:16:33 +0000 (17:16 +0100)]
Remove unneeded suppression

We are catching only checked exceptions, no need for the suppression.

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