mdsal.git
23 months agoModernize EntityOwnershipChangeState 92/101492/2
Robert Varga [Wed, 8 Jun 2022 09:00:12 +0000 (11:00 +0200)]
Modernize EntityOwnershipChangeState

Bring this class to modern world:
- Use Boolean.hashCode(boolean)
- Use 'var'
- Use instanceof pattern

Change-Id: I5d902e35f6581a0df4d114f9884438c402d5dae0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoDo not use ListenerRegistration in DOMSchemaService 90/101490/4
Robert Varga [Wed, 8 Jun 2022 08:10:24 +0000 (10:10 +0200)]
Do not use ListenerRegistration in DOMSchemaService

Expose only Registration.

Change-Id: Ia5ddf7e97760b9d5a7bfb8c28f0aa21989b7f5e7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoUse instanceof patterns 91/101491/2
Robert Varga [Wed, 8 Jun 2022 08:52:10 +0000 (10:52 +0200)]
Use instanceof patterns

Remove redundant casts to make things a tad simpler.

Change-Id: Iadefb90681431da9e716e4b7050b8e9da39044cf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoDo not generate java.beans.ConstructorProperties 83/101483/1
Robert Varga [Tue, 7 Jun 2022 08:21:11 +0000 (10:21 +0200)]
Do not generate java.beans.ConstructorProperties

We are generating ConstructorParameters, there is no need for
java.desktop dependency here.

JIRA: MDSAL-757
Change-Id: Ibaa0c20194052b7b85a0ba37f59f5c86c99534a7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoCleanup docs links 72/101472/1
Robert Varga [Mon, 6 Jun 2022 12:27:19 +0000 (14:27 +0200)]
Cleanup docs links

We have a more modern Guava and do not use old commons-lang.

Change-Id: I1716c399b3235bff7f4f12acef3433d9984a8f6a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoFreeze odlparent at 11.0.0 71/101471/1
Robert Varga [Mon, 6 Jun 2022 12:25:59 +0000 (14:25 +0200)]
Freeze odlparent at 11.0.0

Do not use snapshots.

Change-Id: If8a4b6128de80a5f74917b7327d73dff1938aa92
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoSwitch to jakarta.annotation-api 21/101421/2
Ivan Hrasko [Wed, 1 Jun 2022 18:57:31 +0000 (20:57 +0200)]
Switch to jakarta.annotation-api

Since odlparent has switched to jakarta we have to move from
javax.annotation-api to jakarta.annotation-api.

Change-Id: If6fcded7168674d454033f8b7602a0afb0f64221
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
2 years agoModernize LazyDataObjectModification 65/101365/4
Robert Varga [Mon, 30 May 2022 16:02:04 +0000 (18:02 +0200)]
Modernize LazyDataObjectModification

Use switch expressions to eliminate unneeded default cases.

Change-Id: Iaf8124fc86cf71e7b7a1d589a21b3c7b85b90767
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoModernize BindingStructuralType 63/101363/3
Robert Varga [Mon, 30 May 2022 15:54:59 +0000 (17:54 +0200)]
Modernize BindingStructuralType

Use switch expressions to remove an unused default case.

Change-Id: I5bbbcafebfb24af79c0ecb4d16b5dc6d9425c3d9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoUse instanceof pattern in RpcServiceAdapter 64/101364/2
Robert Varga [Mon, 30 May 2022 15:59:33 +0000 (17:59 +0200)]
Use instanceof pattern in RpcServiceAdapter

Remove an superfluous cast.

Change-Id: Icd1d576b13ff740fbfdf677b05848a0214fcf6fb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoUse instanceof patterin ActionAdapter 62/101362/1
Robert Varga [Mon, 30 May 2022 15:54:37 +0000 (17:54 +0200)]
Use instanceof patterin ActionAdapter

Ditch a superfluous cast.

Change-Id: I17719c5f16da445c2d39eef1e4948f4efd9fc433
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoModernize AbstractCompositeRuntimeType 61/101361/1
Robert Varga [Mon, 30 May 2022 15:48:22 +0000 (17:48 +0200)]
Modernize AbstractCompositeRuntimeType

Use a switch expression to make initialization more explicit.

Change-Id: I349adb2626b13b55a6d122bcfb480acc6c380adc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoModernize Generator 60/101360/1
Robert Varga [Mon, 30 May 2022 15:45:27 +0000 (17:45 +0200)]
Modernize Generator

Use switch expressions and instanceof patterns to make the code more
expressive and ditch a few default cases.

Change-Id: I72e3abd0edc68c923500e006a17152bdadfd3fc3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoModernize AbstractTypeObjectGenerator 59/101359/1
Robert Varga [Mon, 30 May 2022 15:40:24 +0000 (17:40 +0200)]
Modernize AbstractTypeObjectGenerator

Use switch expressions and instanceof pattern matches.

Change-Id: Icf302df71d019db527fd1472d68b55a9100c536f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoModernize SchemaRootCodecContext 58/101358/1
Robert Varga [Mon, 30 May 2022 15:36:06 +0000 (17:36 +0200)]
Modernize SchemaRootCodecContext

Use switch expressions and instanceof patterns to improve
expressiveness.

Change-Id: I08f8806dca5cc1936b2d39ff7c3e2b7b5efc0e60
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoUse switch expression in IdentifiableItemCodec 57/101357/1
Robert Varga [Mon, 30 May 2022 15:31:47 +0000 (17:31 +0200)]
Use switch expression in IdentifiableItemCodec

An expression is more appropriate here, as we always return a result.

Change-Id: I6cb1d5ef2f04aa1156ef23d789ff52eb3b5600bb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoModernize DataContainerCodecPrototype 56/101356/1
Robert Varga [Mon, 30 May 2022 15:28:51 +0000 (17:28 +0200)]
Modernize DataContainerCodecPrototype

Use pattern matching on instanceof and arrow cases. Also split off
ChoiceSchemaNode addressability computation to speed things up just
a bit.

Change-Id: I9deaab2a97becabbe63b3aa5602301239847358e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoSpecialize AbstractDOMForwardedCompositeTransaction 55/101355/2
Robert Varga [Mon, 30 May 2022 12:39:39 +0000 (14:39 +0200)]
Specialize AbstractDOMForwardedCompositeTransaction

This is an internal class, which is always specialized to
LogicalDatastoreType. Bake that into the class design rather
having it as a generic argument.

Change-Id: Iec65a658fa29932cdb3a9370927ef1e99b4f6a68
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoUse switch expressions in mdsal-binding-model-ri 54/101354/1
Robert Varga [Mon, 30 May 2022 08:46:42 +0000 (10:46 +0200)]
Use switch expressions in mdsal-binding-model-ri

We can improve code layout a bit by using a switch expression.

Change-Id: I0784fa87890d81849e08f531b84b081033166c32
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoUse arrow case in BindingMapping 53/101353/1
Robert Varga [Mon, 30 May 2022 08:41:55 +0000 (10:41 +0200)]
Use arrow case in BindingMapping

This makes the switch expression a bit denser.

Change-Id: I168148a8c6d46a51cd5619cd52e314b9fd3e5453
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoUse instanceof pattern in BindingReflections 52/101352/1
Robert Varga [Mon, 30 May 2022 08:40:47 +0000 (10:40 +0200)]
Use instanceof pattern in BindingReflections

Reduce the number of casts.

Change-Id: I220b063f9ce81d7487fdf35ef2648193cb7c4cb6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoUse a switch expression in IMDS 51/101351/1
Robert Varga [Mon, 30 May 2022 08:26:10 +0000 (10:26 +0200)]
Use a switch expression in IMDS

We are switching on enum, use exhaustiveness.

Change-Id: I87c805961628a201c540cd045705e3c589055fbf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoCleanup mdsal-singleton-dom-impl dependencies 47/101347/1
Robert Varga [Sun, 29 May 2022 21:34:55 +0000 (23:34 +0200)]
Cleanup mdsal-singleton-dom-impl dependencies

We have dependency warnings, clean them up.

Change-Id: Icc376b6a512d36f694e2c37992f9a7f9e2bab43b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoUse switch expressions in mdsal-singleton-dom-impl 46/101346/1
Robert Varga [Sun, 29 May 2022 21:29:33 +0000 (23:29 +0200)]
Use switch expressions in mdsal-singleton-dom-impl

Switch expressions allow us to elimiate default branches, use them
to improve clarity.

Change-Id: I648f0a1ed385e9654e8720db9e0d333eef38f4b1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoUse arrow cases in mdsal-replicate-netty 45/101345/1
Robert Varga [Sun, 29 May 2022 21:22:52 +0000 (23:22 +0200)]
Use arrow cases in mdsal-replicate-netty

Ditch explicit breaks and use arrow cases instead.

Change-Id: Id3a3c6deab7b6137f7c965e9bd0d08454a4970b1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoUse switch expressions in mdsal-yanglib-rfc8525 44/101344/1
Robert Varga [Sun, 29 May 2022 21:19:33 +0000 (23:19 +0200)]
Use switch expressions in mdsal-yanglib-rfc8525

We can ditch some defaults by leveraging exhaustiveness checks implied
by switch expressions.

Change-Id: Ie0ad446e568c3dce9689115c4bbe4cdcc45310c4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoUse a switch expression in LogicalDatastoreType 43/101343/1
Robert Varga [Sun, 29 May 2022 21:17:02 +0000 (23:17 +0200)]
Use a switch expression in LogicalDatastoreType

Reduce verbosity by using a switch expression.

Change-Id: I5746513d590c534044fd1a7131bf9ecb1745eb0f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoModernize Datastore 42/101342/1
Robert Varga [Sun, 29 May 2022 21:16:27 +0000 (23:16 +0200)]
Modernize Datastore

Seal the class to enforce the two classes we have. Also use a switch
expression for mapping.

Change-Id: I7e7b281b6963f4e37a3f78201aca577108d40c40
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoCorrect mdsal-binding-runtime-spi dependencies 98/101298/1
Robert Varga [Wed, 25 May 2022 15:43:49 +0000 (17:43 +0200)]
Correct mdsal-binding-runtime-spi dependencies

We have a number of warnings here, clean up the dependencies.

Change-Id: I7fdca0924ecec08b3ab4c173b543f75a4b6de43b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoActivate YangLibrarySupport lazily 97/101297/1
Robert Varga [Wed, 25 May 2022 15:28:50 +0000 (17:28 +0200)]
Activate YangLibrarySupport lazily

SCR has the ability to instantiate service providers as needed. Use that
facility to start YangLibrarySupport. Also express the dependency on SCR
so that we guard loading.

Change-Id: Ib0a305939899b27d34615d34c4d7190aec3b1601
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoRemove _dsannotations-options override 93/101293/1
Robert Varga [Wed, 25 May 2022 14:44:19 +0000 (16:44 +0200)]
Remove _dsannotations-options override

We have a modern maven-bundle-plugin, which includes a fixed-up bnd
library and generates proper provides to match ComponentFactory
annotations. Remove suppressions that were needed to make these work.

Change-Id: Ia2a19c69fa11c1d89df733143449fa6954701024
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoImprove PingPongTransactionChain coverage 07/100807/13
Samuel Schneider [Tue, 26 Apr 2022 07:56:26 +0000 (09:56 +0200)]
Improve PingPongTransactionChain coverage

Add tests for PingPongTransactionChain covering unhappy paths

JIRA: MDSAL-698
Change-Id: I330458ac53d4f1ca58bbed0edaf2886745aef916
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
2 years agoCreate AbstractPingPongTransactionChain 62/100862/5
Robert Varga [Mon, 23 May 2022 11:23:40 +0000 (13:23 +0200)]
Create AbstractPingPongTransactionChain

In order to test the various codepaths we need to be able to simulate
multi-threaded access and various race conditions. Rather than resorting
to mocking final classes, separate the implementation into an internal
abstract class. The test suite can then create a subclass with suitable
hooks.

JIRA: MDSAL-698
Change-Id: Id957d15173a96750385b95647824ba188f6d35c9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoAdd create/create test for PingPongTransactionChain 64/101264/1
Robert Varga [Mon, 23 May 2022 11:55:57 +0000 (13:55 +0200)]
Add create/create test for PingPongTransactionChain

Extend the test to cover allocation of concurrent transactions.

Change-Id: I5ba10cfe335499645441afe0a7ec8d5e6a6691ce
JIRA: MDSAL-698
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoAdd create/cancel/create test for PingPongTransactionChain 63/101263/2
Robert Varga [Mon, 23 May 2022 11:44:06 +0000 (13:44 +0200)]
Add create/cancel/create test for PingPongTransactionChain

Extend the test to cover allocation of next transaction after
a vaild cancel() call.

JIRA: MDSAL-698
Change-Id: Icbaacaa1140cdb6f1d0ffc98cd7b9411db578f6b
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoClean up SnapshotBackedRead(Write)TransactionTest 62/101262/2
Robert Varga [Mon, 23 May 2022 11:00:30 +0000 (13:00 +0200)]
Clean up SnapshotBackedRead(Write)TransactionTest

Use assertThrows() and other assertions, reducing the number of
CheckStyle violations and improving test converage.

JIRA: MDSAL-698
Change-Id: I6ce0e66c23f30bce65cd3b006064f75bfb215c80
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoClean up EOS dependencies 24/101224/1
Robert Varga [Wed, 18 May 2022 11:01:55 +0000 (13:01 +0200)]
Clean up EOS dependencies

We have a bit of a mess in dependencies, let's clean them up as much as
possible.

Change-Id: Ibc1984e95943846a19ca6de3a887694785db076d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDo not use RevisionSourceIdentifier 76/101076/1
Robert Varga [Wed, 11 May 2022 13:42:38 +0000 (15:42 +0200)]
Do not use RevisionSourceIdentifier

We only have SourceIdentifier now, adjust codebase to reflect this.

Change-Id: I52ab8d0d9bf9ee920df33d40c467acb5e1223185
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoAdjust for ModuleImport type change 75/101075/2
Robert Varga [Wed, 11 May 2022 13:38:03 +0000 (15:38 +0200)]
Adjust for ModuleImport type change

We are using Unqualified, not String, hence we need to unpack it.

Change-Id: I1227a66256351acbd534701506230c8c7147972a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoUse HexFormat to print out byte[] properties 35/100935/5
ivan.martiniak [Tue, 3 May 2022 11:32:21 +0000 (13:32 +0200)]
Use HexFormat to print out byte[] properties

HexFormat.of().formatHex(byte[] arr)
 - transform byte array to hex formated string,

For comparison array formated with Arrays.toString()
[-32,79,-48,32,-22,58,105,16,-94,-40,8,0,43,48,48,-99],
with formatHex() it is string "e04fd020ea3a6910a2d808002b30309d".

The main difference is that array formatted with formatHex()
does not contain signed values, what was a condition
in the task description.

The test was required to be changed as well because it was
dependent on Arrays.toString() method.

JIRA: MDSAL-692
Change-Id: Ica9e399d61d54ac19369d3b2a9f60c9690b44128
Signed-off-by: ivan.martiniak <ivan.martiniak@pantheon.tech>
2 years agoBump byte-buddy to 1.12.10 08/100908/1
Robert Varga [Mon, 2 May 2022 08:15:01 +0000 (10:15 +0200)]
Bump byte-buddy to 1.12.10

https://github.com/raphw/byte-buddy/releases/tag/byte-buddy-1.12.10

Change-Id: I3cf43e7adf6e99bc9794e3e561645646d5a4c720
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoFix lead transaction cancellation 69/100869/4
Robert Varga [Thu, 28 Apr 2022 16:08:23 +0000 (18:08 +0200)]
Fix lead transaction cancellation

We have a thinko around recording frontend transaction, which leads
to us always cancelling the entire chain. This is not correct, as
evidenced by existing tests.

Correct the book keeping and refactor cancelTransaction() to allow
returning correct result of operation and handle the case where backend
refuses to cancel.

JIRA: MDSAL-756
Change-Id: I553e4de2d09acedf67af63bc292fae0bb5dfed78
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDitch Google Truth 71/100871/1
Robert Varga [Thu, 28 Apr 2022 17:26:13 +0000 (19:26 +0200)]
Ditch Google Truth

Truth is not bringing much to the table, use Hamcrest and JUnit
assertions instead.

Change-Id: Ib1badc61ff2bd2ccea27053b037382c625cb1c04
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoUse Map.entry() in PingPongTransactionChain 68/100868/1
Robert Varga [Thu, 28 Apr 2022 15:38:41 +0000 (17:38 +0200)]
Use Map.entry() in PingPongTransactionChain

Map.entry() is potentially more efficient, use that instead of a
SimpleImmutableEntry.

Change-Id: I26a27f5f36a4c57b2e21158af78e4b50a787c24c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoUse VarHandles in PingPongTransactionChain 57/100857/3
Robert Varga [Thu, 28 Apr 2022 07:25:39 +0000 (09:25 +0200)]
Use VarHandles in PingPongTransactionChain

Most of our accesses are compareAndSwap() so we do not benefit all
that much from ARFU type safety. Switch to using VarHandles to access
our atomic fields. Provide an acquireReadyTx() to deal with the few
call sites which would require explicit cast due to using getAndSet().

VarHandles allow us to use compareAndExchange(), which exposes the
witness value -- hence our error paths report the correct object without
a possibility of a race.

Change-Id: I79d2791f6e0d6accb987e46d31415452f735a7f8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoReduce volatile variable access 59/100859/2
Robert Varga [Thu, 28 Apr 2022 08:06:34 +0000 (10:06 +0200)]
Reduce volatile variable access

The checkState() and verify() calls are costing us a superfluous
access after we have already accessed the volatile field. Refactor
them to prevent that.

Change-Id: I07c552593a89fb8929985ac637c6fba576b4e659
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoFix a nullability warning in PingPongTransactionChain 58/100858/1
Robert Varga [Thu, 28 Apr 2022 07:54:33 +0000 (09:54 +0200)]
Fix a nullability warning in PingPongTransactionChain

Eclipse is flagging multiple accessed to the same field. The field
cannot move on us, but use a local variable to make the value invariant.

Change-Id: I81599fecc77861d5011e45fa336c554e412f87dc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoRemove dependency on jna 56/100856/1
Robert Varga [Wed, 27 Apr 2022 20:08:36 +0000 (22:08 +0200)]
Remove dependency on jna

We no longer need this, as we do not generate documentation for
byte-buddy.

Change-Id: I0c7e537393ab4a707dedcc163737c24b3abfa15c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoUse osgi componentn artifacts for docs 55/100855/1
Robert Varga [Wed, 27 Apr 2022 19:56:56 +0000 (21:56 +0200)]
Use osgi componentn artifacts for docs

Remove the use of osgi.{core,cmpn} and use individual packages.

Change-Id: Iaa0c06073204906a608d05b31711962b5981b844
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoUse instanceof pattern match in fieldsFrom() 51/100851/1
Robert Varga [Wed, 27 Apr 2022 16:56:13 +0000 (18:56 +0200)]
Use instanceof pattern match in fieldsFrom()

With JD17 we can use a pattern match to cast the argument only once,
simplifying the generated code and the codegen a bit.

Change-Id: I14c61480eee3d0214d43af2337c5fd0cf9b7d3ae
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoUse 'var' for augmentation variable 50/100850/1
Robert Varga [Wed, 27 Apr 2022 16:43:08 +0000 (18:43 +0200)]
Use 'var' for augmentation variable

Simplify the variable declaration and corresponding codegen bit
by relying on local variable type inference.

Change-Id: I3976b20ce5acbce66b1057bb3e374e18aaef3155
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoGenerate documentation for builder getters 49/100849/1
Robert Varga [Wed, 27 Apr 2022 16:36:39 +0000 (18:36 +0200)]
Generate documentation for builder getters

Javadoc rightfully complains about Builders not documenting its getFoo()
methods. Add the javadocs pointing to their interface counterparts.

JIRA: MDSAL-755
Change-Id: Iacb5480b3bc0490d7c088add9e681076d067635d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoGenerate javadoc for builder setters 48/100848/1
Robert Varga [Wed, 27 Apr 2022 16:23:30 +0000 (18:23 +0200)]
Generate javadoc for builder setters

Setters are utterly undocumented. Add javadocs which point to the
corresponding interface method.

JIRA: MDSAL-755
Change-Id: I1d51ea8499d430ed231197e6448a1122d7ac0f27
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoImport exception references 47/100847/1
Robert Varga [Wed, 27 Apr 2022 15:39:42 +0000 (17:39 +0200)]
Import exception references

We may be generating a competing construct, hence need to use
importedName for {IllegalArgument,NullPointer}Exception.

Change-Id: I3fe59a745bc17b292d8d50e6c55ef8669b0ee35a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDocument Builder.augmentation() 46/100846/1
Robert Varga [Wed, 27 Apr 2022 15:32:38 +0000 (17:32 +0200)]
Document Builder.augmentation()

Builder's augmentation() method needs some javadoc to fix linting
warnings.

JIRA: MDSAL-755
Change-Id: I1bc62ea6753411159a9d21eca95eaf40b799d2b1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoAnnotate non-null build() return 45/100845/1
Robert Varga [Wed, 27 Apr 2022 15:22:10 +0000 (17:22 +0200)]
Annotate non-null build() return

Builder.build() always returns a non-null value, make sure we annotate
it properly.

Change-Id: I88df931e4d98481354d8e418909248f2d23d2b68
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoUse Map.of() instead of Collections.emptyMap() in builders 44/100844/1
Robert Varga [Wed, 27 Apr 2022 15:02:43 +0000 (17:02 +0200)]
Use Map.of() instead of Collections.emptyMap() in builders

Augmentation field is not used by the builder-internal implementation,
hence we can inline the codegen. Also use Map.of() instead of
emptyMap().

Change-Id: I62e9b92b31355abd917a05a01c94f46230f449ec
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoFix a minor typo 43/100843/2
Robert Varga [Wed, 27 Apr 2022 14:57:16 +0000 (16:57 +0200)]
Fix a minor typo

'wich' should be 'which'.

Change-Id: I20295881f28c139b0ec7a04678272e762969efe5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDocument builder constructors 42/100842/2
Robert Varga [Wed, 27 Apr 2022 14:49:58 +0000 (16:49 +0200)]
Document builder constructors

Javadoc is not entirely happy with us not generating any documentation
for various Builder constructors. Fix this by adding some rudimentary
javadoc.

JIRA: MDSAL-755
Change-Id: Icaec59bb86d21f372e341ea93d9d89cbb2599951
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoImprove Builder's fieldsFrom() javadoc 41/100841/1
Robert Varga [Wed, 27 Apr 2022 14:47:45 +0000 (16:47 +0200)]
Improve Builder's fieldsFrom() javadoc

We are listing out types, but do not link them. Fix this by making
each item a {@link}.

JIRA: MDSAL-755
Change-Id: I3bf6f8a97bd004cb88bee3fbc6b6b0ef373a36d0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDocument QNAME constant 40/100840/1
Robert Varga [Wed, 27 Apr 2022 14:30:52 +0000 (16:30 +0200)]
Document QNAME constant

Javadoc does not like the constant not being documented. Make sure
we attach a bit of documentation.

JIRA: MDSAL-755
Change-Id: Ib56879225ea7653f22770d5e097d350e931ece13
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDocument YangModuleInfo(Provider) 39/100839/1
Robert Varga [Wed, 27 Apr 2022 14:19:24 +0000 (16:19 +0200)]
Document YangModuleInfo(Provider)

New javadoc is rather more noisy about missing documentation. Improve
the situation for module info and its ServiceLoader provider.

JIRA: MDSAL-755
Change-Id: I9d008a737b4db992664b24babfe206219b975e90
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoRepair version declarations 32/100832/1
Robert Varga [Wed, 27 Apr 2022 06:50:22 +0000 (08:50 +0200)]
Repair version declarations

Previous search and replace has bumped our versions to an illegal
string, fix that up.

Change-Id: Ic1f0204ea78384e0c1f542c902ef9ce46bcb8d89
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoSeal more Binding contracts 08/100808/5
Robert Varga [Tue, 26 Apr 2022 10:03:56 +0000 (12:03 +0200)]
Seal more Binding contracts

DataContainer/BindingObject/BindingContract provide structural
hierarchy which is fixed with codegen attaching to specific endpoints.
Make sure we express this invariant by sealing the interior of the
hierarchy.

Change-Id: I5121b5afe9a880600e7ee12700fc954352afa82d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoRemove RpcServiceInvoker.from(Class) 23/100823/1
Robert Varga [Tue, 26 Apr 2022 16:16:28 +0000 (18:16 +0200)]
Remove RpcServiceInvoker.from(Class)

This method is not used anywhere and has been deprecated since version
9.0.3. Remove it and its underlying implementation.

Change-Id: I81965075c38aec0ec7fd0da5eaf4b8fe1d867a7b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDeprecate RpcServiceInvoker.from(Class) 22/100822/1
Robert Varga [Tue, 26 Apr 2022 16:10:52 +0000 (18:10 +0200)]
Deprecate RpcServiceInvoker.from(Class)

Invokers are considered an implementation detail and this particular
method is not used anywhere except tests. Schedule it for removal along
with ClassBasedRpcServiceInvoker it uses.

Change-Id: I4d8c57bbd982ea6eae21706d909af16495f29f56
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoSeal YangSourceDefinition 11/100811/4
Robert Varga [Tue, 26 Apr 2022 10:11:21 +0000 (12:11 +0200)]
Seal YangSourceDefinition

YangSourceDefinition cannot be subclassed externally, make it a sealed
class.

Change-Id: Ibebd2c13dc4fac4e2def7f0924b2558b728e2f96
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoSeal JavaTypeName 10/100810/4
Robert Varga [Tue, 26 Apr 2022 10:10:41 +0000 (12:10 +0200)]
Seal JavaTypeName

JavaTypeName cannot be externally subclassed, make it a sealed class.

Change-Id: I2f79f8cf3d4ff060ebb269a1d2fc0f57a3cda604
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoClean up mdsal-binding-java-api-generator dependencies 21/100821/3
Robert Varga [Tue, 26 Apr 2022 14:52:50 +0000 (16:52 +0200)]
Clean up mdsal-binding-java-api-generator dependencies

We have a number of used dependencies which are not declared, clean them
up.

Change-Id: Iaaa3c808ff8f8c89b3c0bb67ad169eedefeade77
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoFix mdsal-binding-model-api dependencies 12/100812/4
Robert Varga [Tue, 26 Apr 2022 10:13:15 +0000 (12:13 +0200)]
Fix mdsal-binding-model-api dependencies

We have a few warnings about used dependencies, fix that up.

Change-Id: I3ab19de156c637cc97ad06ef8d98a9284601b44a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoFixup mdsal-binding-model-api module definition 09/100809/4
Robert Varga [Tue, 26 Apr 2022 10:08:44 +0000 (12:08 +0200)]
Fixup mdsal-binding-model-api module definition

We require SLF4J, make sure to mention that.

Change-Id: Ibbdb5438ef60f4c5fc70c590e3fdfdbe2c0c4b8f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoGenerate a switch expression in forName()/forIntValue() 16/100816/4
Robert Varga [Tue, 26 Apr 2022 12:53:38 +0000 (14:53 +0200)]
Generate a switch expression in forName()/forIntValue()

JDK17 allows us to use switch expressions, which are nice and concise
way of matching values. Use them instead of ImmutableMaps for value
lookups.

JIRA: MDSAL-753
Change-Id: I1f12eb7469ce08ee66024abfb2bef5305f1cee63
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoCleanup enumeration static factory methods 15/100815/4
Robert Varga [Tue, 26 Apr 2022 12:47:23 +0000 (14:47 +0200)]
Cleanup enumeration static factory methods

We have some amount of inconsistency around enumeration returns. Improve
the situation by making forName() return a nullable value and add
ofName()/ofValue() methods which throw IAE.

While we are modifying the template, also add proper @Nullable and
@NonNull annotations.

JIRA: MDSAL-754
Change-Id: I07fe4b408174ba830bcc1369ed70597ea2538a85
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoFix mdsal-binding-test-model maven warning 17/100817/3
Robert Varga [Tue, 26 Apr 2022 12:57:19 +0000 (14:57 +0200)]
Fix mdsal-binding-test-model maven warning

We are using two dependencies without declaring them, fix that up.

Change-Id: Ifd71d0b5c7768107e004d3c851369d404fc8cbba
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDo not mock YangInstanceIdentifier 19/100819/1
Robert Varga [Tue, 26 Apr 2022 13:39:00 +0000 (15:39 +0200)]
Do not mock YangInstanceIdentifier

We just need a simple YangInstanceIdentifier. Do not mock it, but
rather use the correct value.

Change-Id: I8498973e71f394c736c4abab4b481f756ca0e2f8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoModernize SimpleDOMMountPointTest 18/100818/1
Robert Varga [Tue, 26 Apr 2022 13:18:02 +0000 (15:18 +0200)]
Modernize SimpleDOMMountPointTest

Do not use YangInstanceIdentifier mocking and clean up the structure
with better asserts.

Change-Id: Id8da5ad4c549990822628c50068b0ba5565408cc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoUse HexFormat instead of home-grown formatting 05/100805/2
Robert Varga [Mon, 25 Apr 2022 20:09:11 +0000 (22:09 +0200)]
Use HexFormat instead of home-grown formatting

JDK17 provides a ready-to-use HexFormat facility. Use it to format
mac-address/hex-string/phys-address/ipv6-address.

Change-Id: I3a99a5e27db1e75384e3d8b9879c83400273e715
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoSeal BaseNotification 03/100803/4
Robert Varga [Mon, 25 Apr 2022 19:26:06 +0000 (21:26 +0200)]
Seal BaseNotification

BaseNotification should never be used directly, only through
Notification and InstanceNotification.

Change-Id: Ib3fd70aeb364523d7f630eb6e882f2308e427884
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoPick up odlparent/yangtools snapshots 02/100802/5
Robert Varga [Mon, 25 Apr 2022 19:09:37 +0000 (21:09 +0200)]
Pick up odlparent/yangtools snapshots

Use snapshots for upstreams in order to get updates and JDK17 support.

Change-Id: Ie9dc7e34084b86cbb7e1c931ca884458d92c185c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoModernize NotificationListenerInvokerTest 04/100804/1
Robert Varga [Mon, 25 Apr 2022 19:46:21 +0000 (21:46 +0200)]
Modernize NotificationListenerInvokerTest

Improve assertions and use assertThrows().

Change-Id: Iee3847231e97a1e755559b13eb54b57fbf67c853
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoFix checkstyle 01/100801/3
Robert Varga [Mon, 25 Apr 2022 19:11:44 +0000 (21:11 +0200)]
Fix checkstyle

Updated checkstyle is finding a few violations, fix them up.

Change-Id: I7a9cb9a19dc20de08a856c7752af8f060585e342
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoYet another fix for javadoc 65/100665/1
Robert Varga [Wed, 20 Apr 2022 09:02:02 +0000 (11:02 +0200)]
Yet another fix for javadoc

The method takes a long not an int, fix that up.

Change-Id: Ic7c508775b2a3854b13d3b7c25cdd2c21e603481
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoFix InstanceNotificationPublishService javadoc 63/100663/1
Robert Varga [Wed, 20 Apr 2022 07:40:53 +0000 (09:40 +0200)]
Fix InstanceNotificationPublishService javadoc

We have bad references here, fix them up.

Change-Id: I58a23cb616f808f33840ebfe3abf53345d21fe76
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoConvert mdsal-binding-dom-codec-osgi to a JPMS module 61/100661/1
Robert Varga [Wed, 20 Apr 2022 05:13:58 +0000 (07:13 +0200)]
Convert mdsal-binding-dom-codec-osgi to a JPMS module

This is a simple implementation, convert it to JPMS module, fixing up
warnings in the process of doing so.

JIRA: MDSAL-641
Change-Id: I03f71512580ae9c6b48d5acd0d0c6e77a02f3e82
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoConvert mdsal-binding-dom-codec to a JPMS module 78/97078/13
tadei.bilan [Mon, 19 Jul 2021 14:19:52 +0000 (17:19 +0300)]
Convert mdsal-binding-dom-codec to a JPMS module

Convert mdsal-binding-dom-codec to a properly-injected JPMS module,
available through @Singleton, @Component and @MetaInfServices.

Also update NonCachingCodecTest to expose its mock fields and
UnionValueOptionContextTest to use test-model's classes.

This also necessitates relocating the loeader package, as otherwise
maven-javadoc-plugin ends up being confused passes down invalid
@packages to javadoc.

JIRA: MDSAL-641
Change-Id: I3cbe8da4fc4905a1246a5e94a7e208e1bccfa1d8
Signed-off-by: tadei.bilan <tadei.bilan@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoRemove unneeded doc dependency 47/100647/1
Robert Varga [Tue, 19 Apr 2022 16:41:34 +0000 (18:41 +0200)]
Remove unneeded doc dependency

We are no longer shading byte-buddy, hence we can clean up docs/pom.xml.

Change-Id: Ic7eda3da04a3fee4410c78e84d072574dd87d39a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoBump byte-buddy to 1.12.9 42/100642/1
Robert Varga [Mon, 18 Apr 2022 17:51:04 +0000 (19:51 +0200)]
Bump byte-buddy to 1.12.9

https://github.com/raphw/byte-buddy/releases/tag/byte-buddy-1.12.9

Change-Id: I28743e471ab4200f4ef50c6b87950fe7c353c55b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoAdd odl-mdsal-bytebuddy 41/100641/1
Robert Varga [Mon, 18 Apr 2022 17:48:21 +0000 (19:48 +0200)]
Add odl-mdsal-bytebuddy

Rather than shading byte-buddy, provide it in a separate feature.
This will allow packagers better control of the runtime we link to
and allow it to be reused.

JIRA: MDSAL-747
Change-Id: Id25acfdb24cce9ce2529b0ac8706b8f00671ed7b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoMap identities to proper objects 17/100117/20
Robert Varga [Mon, 14 Mar 2022 09:31:49 +0000 (10:31 +0100)]
Map identities to proper objects

Change the binding type mapping from Class<? extends BaseIdetity>
to proper objects. While this imposes some runtime footprint in terms of
loaded classes (there is an anonymous implementation of each identity)
and objects (that implementation is an eager singleton), it removes a
metric ton of irregularities. This this change, all mapped objects
objects can be checked via 'instanceof' and most of them have
implementedInterface() for exact contract matches.

JIRA: MDSAL-733
Change-Id: Iab7dfb7656db87850613f567dfe40ef31494f6c4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoUse StringBuilder fluently 30/100630/1
Robert Varga [Thu, 14 Apr 2022 20:00:51 +0000 (22:00 +0200)]
Use StringBuilder fluently

This is just a bunch of appends, use the return value to chain them.

Change-Id: I7db1a134387ae6ac0b756886d06264cbb8ffa43b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDo not generate union builders 96/100496/7
Robert Varga [Fri, 8 Apr 2022 21:00:37 +0000 (23:00 +0200)]
Do not generate union builders

Union builds are not referenced by generated code anymore and have a
number of issues which need to be addressed separately. Just do not
generate them at all, pending a proper factory replacement.

JIRA: MDSAL-49
Change-Id: I6b769ca4d82da16b9f48720e8a17d7c4e1b4e8ef
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoBump versions to 10.0.0-SNAPSHOT 13/100613/1
Robert Varga [Thu, 14 Apr 2022 12:34:13 +0000 (14:34 +0200)]
Bump versions to 10.0.0-SNAPSHOT

This starts the next major development iteration.

Change-Id: Id30b892ae437fc78f930b372ddf69c85d8724f05
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoSpecialize CompositeValueCodec 10/100610/3
Robert Varga [Thu, 14 Apr 2022 11:34:59 +0000 (13:34 +0200)]
Specialize CompositeValueCodec

We have only two codec interactions, both of which have dom-codec-api
not tied to IllegalArgumentCodec. Specialize the class and use our codec
API.

JIRA: MDSAL-704
Change-Id: Ic4b219f3e328fe3244811a57037fe1d1780e141f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoRemove ValueTypeCodec 09/100609/2
Robert Varga [Thu, 14 Apr 2022 11:15:20 +0000 (13:15 +0200)]
Remove ValueTypeCodec

CompositeValueCodec is null-hostile, hence it can directly subclass
AbstractIllegalArgumentCodec. This leaves UnionTypeCodec as the only
ValueTypeCodec -- hence we can remove the indirection, making the type
hierachy crisper.

JIRA: MDSAL-704
Change-Id: I7661263f5dd7684cebcff7af82d76a1fe0d9b1eb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoSimplify CompositeValueCodec instantiation 87/100587/2
Robert Varga [Thu, 14 Apr 2022 10:51:11 +0000 (12:51 +0200)]
Simplify CompositeValueCodec instantiation

We have some long-winded instantiation here, which amounts to getting an
EncapsulatedValueCodec. Specialize two constructors for
identityref/instance-identifier to make things a bit more clear and
direct.

JIRA: MDSAL-704
Change-Id: I766d4437ff51a8c32c872f6a3bfe66aec68caa14
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoBump versions to 9.0.3-SNAPSHOT 73/100573/1
Robert Varga [Thu, 14 Apr 2022 06:54:11 +0000 (08:54 +0200)]
Bump versions to 9.0.3-SNAPSHOT

This starts the next development iteration.

Change-Id: I84fc11be536df45edcc531964969ce0bc202e212
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoBump yangtools to 8.0.3 72/100572/1
Robert Varga [Thu, 14 Apr 2022 06:53:33 +0000 (08:53 +0200)]
Bump yangtools to 8.0.3

Pick up fixes from upstream.

Change-Id: I1bb83612ef0c9ad474c2ec4e893c90e2455d62dc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoSchemaUnawareCodec is AbstractIllegalArgumentCodec 41/100541/1
Robert Varga [Tue, 12 Apr 2022 09:45:28 +0000 (11:45 +0200)]
SchemaUnawareCodec is AbstractIllegalArgumentCodec

AbstractIllegalArgumentCodec is null-hostile, just as really all
SchemaUnawareCodecs are. Express this in a the type hierarchy,
coalescing things to a place where we can do a like-for like
replacement.

JIRA: MDSAL-704
Change-Id: I44cc2a0d0e5abcb7ea696eeba65dfe892c5daafb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoSwitch SchemaUnawareCodec to an abstract class 40/100540/1
Robert Varga [Tue, 12 Apr 2022 09:32:00 +0000 (11:32 +0200)]
Switch SchemaUnawareCodec to an abstract class

We have four implementations here, three of which are indirected via
ValueTypeCodec. Switch the type hierarchy a bit, which leaves only
two codecs still using ValueTypeCodec.

JIRA: MDSAL-704
Change-Id: I4c92f15f7de2678a51792e60431947e4c6acbd6f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDo not indirect UnionLoading through Callable 39/100539/1
Robert Varga [Mon, 11 Apr 2022 17:58:59 +0000 (19:58 +0200)]
Do not indirect UnionLoading through Callable

Let's just declare Exception to be thrown, forcing the caller to deal
with it -- which it already does.

JIRA: MDSAL-704
Change-Id: I21e26b4f40814bb62a03b5e4a46eed3c29f27882
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>