yangtools.git
4 years agoBump versions to 2.0.24-SNAPSHOT 33/85433/1 v2.0.x
Robert Varga [Wed, 30 Oct 2019 14:12:32 +0000 (15:12 +0100)]
Bump versions to 2.0.24-SNAPSHOT

This starts the next development iteration.

Change-Id: I6d081fb9b0d434f2a6812082d7398ead1867b3e4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd lenient JsonParserStream 34/85134/7
serngawy [Tue, 15 Oct 2019 20:00:59 +0000 (16:00 -0400)]
Add lenient JsonParserStream

It is beneficial to have the JSON parser ignore unknown constructs,
so that all other data gets parsed successfully.

This patch adds JsonParserStream.createLenient() to return such
parsers.

JIRA: YANGTOOLS-1034
Change-Id: I5ec9dbbf6dc52270bf83d7c4ed6c4d16181f74a7
Signed-off-by: serngawy <m.elserngawy@gmail.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoExpand MapAdaptor javadoc 04/85304/1
Robert Varga [Tue, 20 Aug 2019 12:17:21 +0000 (14:17 +0200)]
Expand MapAdaptor javadoc

This fixes a few warnings around javadoc completes of MapAdaptor.

Change-Id: I6bb7b6354530b4ad47a07b4b0358c720b80b4230
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 45c0f0b3468741c1b26f8d65f79f722c43e5e3c9)

4 years agoFix Decimal64.equals() 03/85303/1
Robert Varga [Thu, 10 Oct 2019 10:29:23 +0000 (12:29 +0200)]
Fix Decimal64.equals()

There is a typo here, which would end up not comparing objects
properly.

Change-Id: I5cfe31887b109bbe7be6e564078f250ea6b61747
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 3670f3b1080d917bd1bec4611e75a9b345b06023)
(cherry picked from commit faac1484eb8364c4fe52e19c2e1f473c0ce51614)

4 years agoCleanup code smells reported by sonar 02/85302/1
Robert Varga [Fri, 18 Oct 2019 08:02:28 +0000 (10:02 +0200)]
Cleanup code smells reported by sonar

We are duplicating code here, so introduce a check-and-cast method
and use that from the 5 callsites.

Change-Id: Ic1b734f62cb2d79b8dd28a1fcee76cbffea72c33
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 8e1209717df9fe7dfd9bb7a8be1e245e12501ba3)
(cherry picked from commit 1c566c38452819bc915a216d80f60c7823387967)

4 years agoShortcut Collections.sort() 01/85301/1
Robert Varga [Mon, 7 Oct 2019 09:12:01 +0000 (11:12 +0200)]
Shortcut Collections.sort()

We have a concrete List implementation, hence we can use List.sort()
directly.

Change-Id: I4baa0f41ee34479b5a915d6e3670029553b48b82
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 6c70f2b315960611004245950729daa5fa2aa5c0)
(cherry picked from commit 604c74c05838d6864f149673efe06781e3a24256)

4 years agoDisable slf4j SSL link 00/85300/1
Robert Varga [Fri, 11 Oct 2019 12:01:15 +0000 (14:01 +0200)]
Disable slf4j SSL link

slf4j does not provide apidocs over TLS, link HTTP site instead.

Change-Id: I2158c043a2d9e810a329587159fc6af9d57d8e56
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 2a357e7ca8e27873ef49e3bb1f754c92fcea1ca9)
(cherry picked from commit 3d96e8018f3b54538af302ce731142e8d3683560)

4 years agoBump versions to 2.0.23-SNAPSHOT 54/84354/1
Robert Varga [Fri, 13 Sep 2019 02:00:08 +0000 (04:00 +0200)]
Bump versions to 2.0.23-SNAPSHOT

This starts the next release iteration.

Change-Id: I6da87ddd2cba1edad9287d332eac9474442c1e78
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump versions to 2.0.22-SNAPSHOT 60/84260/1
Robert Varga [Fri, 6 Sep 2019 15:20:37 +0000 (17:20 +0200)]
Bump versions to 2.0.22-SNAPSHOT

This was missed during last release, bump the versions now.

Change-Id: Iec95d831d13b1794b6b05d83fc96a4652ee76c3c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoOptimize immutable lookups 37/84137/2
Robert Varga [Mon, 2 Sep 2019 15:25:37 +0000 (17:25 +0200)]
Optimize immutable lookups

We have a number of private Set/Map/Lists which we are using for
lookups. These typically are backed by Immutable implementations,
hence we can propagate the type knowledge to improve bytecode
generation and make JIT's life easier.

Change-Id: I7f90393b8bc76196deced50f1800c3f99424fa1c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 9e0e66b8a190dbd7f2903f1b4457fe4a1660254a)

4 years agoBump odlparent to 3.1.9 66/84066/1
Robert Varga [Thu, 29 Aug 2019 13:21:43 +0000 (15:21 +0200)]
Bump odlparent to 3.1.9

This picks up the latest updates.

Change-Id: Ic094217089945632dea6d11f8bd4fbec57229605
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoExpose ReusableStreamReceiver 47/82647/1
Robert Varga [Thu, 6 Jun 2019 10:23:49 +0000 (12:23 +0200)]
Expose ReusableStreamReceiver

ReusableImmutableNormalizedNodeStreamWriter has two properties
which are not inherently tied to it being bound to immutable nodes:
- it can have its state reset
- it exposes a NormalizedNode result of a streaming session

Expose these traits as ReusableStreamReceiver, so that users
can use the API rather than the implementation.

Change-Id: I841211c89520c4a5c67d436c8a49d719e8f7f1b7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 9e66147b4a8167007e6d3479c449ab9944cce5f9)
(cherry picked from commit 721a100e4ee9042e8ccdc43d09805b88ed94c4da)

4 years agoDeduplicate concurrent SchemaContext loads 46/82646/1
Robert Varga [Tue, 11 Jun 2019 16:53:18 +0000 (18:53 +0200)]
Deduplicate concurrent SchemaContext loads

In case we are running concurrent SchemaContext computation, if
the result is not cached we will have multiple results. These
need to be reconciled with the cache, so that those results will
be squashed into a single instance.

JIRA: YANGTOOLS-1004
Change-Id: I82df2b32a534d0acc803548579fb8ad138853c68
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 6ee69cdac4289a3ef81c2ab989f40522149b89ce)
(cherry picked from commit aceea6f0da6d550ad354721fe7e5c98ab59e2401)

4 years agoAdd AugmentationIdentifier.create() methods 45/82645/1
Robert Varga [Thu, 30 May 2019 17:03:24 +0000 (19:03 +0200)]
Add AugmentationIdentifier.create() methods

This adds two flavors of AugmentationIdentifier.create(), which
use a global weak cache for normalizing AugmentationIdentifiers.

The cache is carefully populated, i.e. it makes a point of using
immutable keys only.

JIRA: YANGTOOLS-998
Change-Id: I1e7d65b995e50773ec2260c9fb01bc1c6bbaafbf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 700dcb02f55c7172c61f16a8318901b276238242)
(cherry picked from commit 0cc211c923a4f925a73fc598baf9d2fe4adf3216)

4 years agoAdd AugmentationIdentifier(ImmutableSet) 44/82644/1
Robert Varga [Wed, 29 May 2019 12:57:45 +0000 (14:57 +0200)]
Add AugmentationIdentifier(ImmutableSet)

There are situations where we know input is an ImmutableSet,
expose a constructor to wire such calls directly.

Change-Id: Id1ae48ee64c88119767c7e538a3379f5bdcb257c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit afb06040fd974957bdcd8b4cd2cbeb22243c4491)
(cherry picked from commit 32fee9e51b2a2dc404cfb2f196b5b3ddfbd9d62f)

4 years agoBump odlparent to 3.1.8 43/82643/1
Robert Varga [Fri, 21 Jun 2019 08:32:36 +0000 (10:32 +0200)]
Bump odlparent to 3.1.8

This bumps odlparent to its latest release.

Change-Id: Icc1eefd957498a97271eba4c89c45f11b68084cc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRevert "Bump odlparent to 3.1.8-SNAPSHOT" 24/82224/1
Robert Varga [Thu, 23 May 2019 11:41:46 +0000 (13:41 +0200)]
Revert "Bump odlparent to 3.1.8-SNAPSHOT"

This reverts commit 4643c7177f6c2f655881b88e64a16218fd0835c7, landing
back on odlparent-3.1.7.

Change-Id: I83ed63c37f4affa2ffdbebb62f6f3b82fc90e3c8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump odlparent to 3.1.8-SNAPSHOT 60/82160/1
Robert Varga [Fri, 17 May 2019 10:31:33 +0000 (12:31 +0200)]
Bump odlparent to 3.1.8-SNAPSHOT

This is preliminary integration.

Change-Id: Ib992d8c054a2c0819bda930262082fc24c6d6ce8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump versions to 2.0.21-SNAPSHOT 30/82130/1
Robert Varga [Thu, 16 May 2019 07:27:49 +0000 (09:27 +0200)]
Bump versions to 2.0.21-SNAPSHOT

This starts the next development iteration.

Change-Id: I5b16a446d9d960573dbeec36b2f381c054ce5558
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRepair accidental API breakage 24/82124/1
Robert Varga [Wed, 15 May 2019 14:32:16 +0000 (16:32 +0200)]
Repair accidental API breakage

NormalizedNodeResultBuilder is visible to subclasses of
ImmutableNormalizedNodeStreamWriter, hence it must not be moved.

Move it back to its original nested place, restoring visibility.

Change-Id: Ida0c6c2f63f7b3e2fd0b719d4a362112afc781de
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump versions to 2.0.20-SNAPSHOT 88/82088/1
Robert Varga [Wed, 15 May 2019 12:31:13 +0000 (14:31 +0200)]
Bump versions to 2.0.20-SNAPSHOT

This starts the next development iteration.

Change-Id: I2ee2eb21d16e0eebbbfe68eeb2ee2cf550d9ca71
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd ReusableImmutableNormalizedNodeStreamWriter 78/82078/1
Robert Varga [Wed, 15 May 2019 08:44:01 +0000 (10:44 +0200)]
Add ReusableImmutableNormalizedNodeStreamWriter

In certain situations it can be beneficial to reuse the same
writer multiple times, resetting it between uses.

This patch adds a reusable version of
ImmutableNormalizedNodeStreamWriter, which provides this service.

JIRA: YANGTOOLS-988
Change-Id: Id74e8ddcaec0e730e805cf300d455c6bf5357156
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 52cb7f67625f434751983a2dcbdd47f8868dc939)

4 years agoBump odlparent to 3.1.7 46/82046/1
Robert Varga [Tue, 14 May 2019 21:23:10 +0000 (23:23 +0200)]
Bump odlparent to 3.1.7

This picks up latest upgrades from upstream.

Change-Id: If13685ec862d621b25b60f959ec88a7096a1b5db
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAllow LeafSetEntryNodes to be added to result builder 30/82030/1
Robert Varga [Tue, 14 May 2019 11:23:28 +0000 (13:23 +0200)]
Allow LeafSetEntryNodes to be added to result builder

This amends the check of parent builders to account for
NormalizedNodeResultBuilder, so that individual entries may be
received. Also optimizes the checking a bit by caching the current
builder instead of fetching it from the stack.

JIRA: YANGTOOLS-987
Change-Id: I7b77bd17ffd4671b5d5c2fbe25dee8d95757a1f0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 8cc9cb02eaaa5699fbea62595079bae00f9efd25)

4 years agoAllow builders to optionally use LinkedHashMap 21/81821/1
Jakub Toth [Tue, 23 Apr 2019 13:46:34 +0000 (06:46 -0700)]
Allow builders to optionally use LinkedHashMap

Some devices are unreasonably touchy about the order of children
we send them -- i.e. they expect to encounter direct container
children before seeing any augmented children. While we push them
to NormalizedNode builders in this order, the builders are using
plain HashMaps (and rightfully so) to track them, which means
they can get reordered.

This patch introduces a new system property,
org.opendaylight.yangtools.yang.data.impl.schema.builder.retain-child-order,
which when set to "true" will cause DataContainerBuilders to use
LinkedHashMaps to track children, sacrificing efficiency to retain
the original insertion order.

JIRA: YANGTOOLS-984
Change-Id: Ica1616c3fa93559c6458eba4030a5ceaac7be58a
Signed-off-by: Jakub Toth <jtoth@luminanetworks.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 6335bf3e7e821d7ec1c221ffb292000c90b0931a)

5 years agoRevision should be Immutable 87/81587/1
Robert Varga [Thu, 11 Apr 2019 19:42:21 +0000 (21:42 +0200)]
Revision should be Immutable

This class has only a single member, which is immutable and is final,
which means it is Immutable. Reflect that in the class hierarchy.

Change-Id: I1cc8866e5d4b3344361581bf0037971855bd2f5d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 309ead000a3fe60ce86d86c8391d6e0c2e3e7720)

5 years agoBump versions to 2.0.19-SNAPSHOT 44/81544/1
Robert Varga [Wed, 10 Apr 2019 23:39:35 +0000 (01:39 +0200)]
Bump versions to 2.0.19-SNAPSHOT

This starts the next development cycle.

Change-Id: Ib4899fc3d58ad5a96bbb8ff7e778bba9b0a0d6da
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoUse XMLStreamException for reporting parsing errors 99/81499/2
Robert Varga [Tue, 9 Apr 2019 17:16:37 +0000 (19:16 +0200)]
Use XMLStreamException for reporting parsing errors

Using IllegalStateException is pure evil, as users do not expect
a RuntimeException to be thrown from contexts which can clearly
report a checked exception.

Use a properly-formatted XMLStreamException instead.

Change-Id: Iecee17e19b3ac380bcb2b7fc1c46f27e789c20bd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit b61a476ed2b4a896b549995a075a687066ecc715)
(cherry picked from commit 6adeda5541f133d784d277f4613e0809486a767b)

5 years agoAlso specify groupid for docs 46/81446/2
Robert Varga [Mon, 8 Apr 2019 13:01:18 +0000 (15:01 +0200)]
Also specify groupid for docs

Version was just one of the missed things, groupId is the other one.

Change-Id: I88a0b992f649a2103afa4ca8a8b25d5e26751e6d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoFIX docs version 28/81428/1
Robert Varga [Mon, 8 Apr 2019 01:26:25 +0000 (03:26 +0200)]
FIX docs version

Unlike v2.1.x and newer, we need to specify version here to make
things work properly.

Change-Id: I9eb5a32891afc6d71f61da7a125ef49c06ce38e6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoFix NONE operation node with automatic lifecycle 27/81427/1
Robert Varga [Mon, 8 Apr 2019 01:15:57 +0000 (03:15 +0200)]
Fix NONE operation node with automatic lifecycle

In case when previous operations fizzle into a NONE operation
on top of a non-present node, automatic lifecycle would fail
because there is no node to disappear.

Fix this case by not requiring the delegate operation to return
a present node.

JIRA: YANGTOOLS-938
Change-Id: I6b4a01af61e148efa0bae3953dd5aa80b2e63398
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 1f36b5e960a68f80d8dcf0d3f259f22f74bf2495)

5 years agoBump version to 2.0.18-SNAPSHOT 84/81284/1
Robert Varga [Fri, 29 Mar 2019 00:46:34 +0000 (01:46 +0100)]
Bump version to 2.0.18-SNAPSHOT

This starts the next development iteration.

Change-Id: I2ebbbe222e4c4601cb7fc123a51ba2b6698c2955
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRemove a stray FIXME 79/81179/2
Robert Varga [Tue, 26 Mar 2019 11:43:00 +0000 (12:43 +0100)]
Remove a stray FIXME

This FIXME was addressed already, remove it.

Change-Id: I697fbf5dec237b6a1b726058d58abd6bf9862805
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 578f3922793006daef79354b2d692b83cd8f1570)

5 years agoStrings Ending in Backslash are Improperly Lexed 81/81181/1
Danielle Mustillo [Mon, 25 Mar 2019 18:27:45 +0000 (14:27 -0400)]
Strings Ending in Backslash are Improperly Lexed

Using greedy match for SUB_STRING fragment's forward lookahead
is troublesome because it will consume all non-double-quotes
until the final one -- including any escapes present.

This patch fixes the lexer to use non-greedy subrule, so that
escapes are properly accounted for.

JIRA: YANGTOOLS-971
Change-Id: Ic93c5c2bfa807001735125bd0367c29a1a25ea99
Signed-off-by: Danielle Mustillo <danielle.mustillo@ericsson.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit e307e3f6893f94bc0a6b3fac094270f3e206eef2)

5 years agoShorten QName.toString() 68/81068/1
Robert Varga [Thu, 21 Mar 2019 09:11:35 +0000 (10:11 +0100)]
Shorten QName.toString()

Take advantage of fluent StringBuilder, removing a bit of bytecode.

Change-Id: I8d7c55b6118066529c2b62d8b48134affd58c1ea
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 89dd96f6dd4261aa44427c7358352dac60fe0a7a)

5 years agoSpeed up QName.intern() a bit 67/81067/1
Robert Varga [Wed, 20 Mar 2019 22:17:37 +0000 (23:17 +0100)]
Speed up QName.intern() a bit

In case we end up interning the localName, we should use the private
constructor to side-step re-validating localName.

Change-Id: I54029d15c93ae32f5c857e890c8313a9f62f58f0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit d5c6acd3148e3a659cce1091955b0b32c9730944)

5 years agoFixup xpath resolution 04/81004/5
Robert Varga [Mon, 18 Mar 2019 16:53:20 +0000 (17:53 +0100)]
Fixup xpath resolution

Add basic handling for method invocations, namely deref() and
interrupted '..' chains.

JIRA: YANGTOOLS-968
Change-Id: I9b99a5aa84039749fb04f1dca8420d41b24ba6e2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit f5b7a9cf4d9cafe0e8b4c7c38168ab0fdb7719fc)

5 years agoHook if-feature statements onto FeatureNamespace 51/80751/1
Robert Varga [Fri, 8 Mar 2019 17:10:07 +0000 (18:10 +0100)]
Hook if-feature statements onto FeatureNamespace

IfFeatureStatementSupport should perform a check against FeatureNamespace,
so that invalid feature references are properly caught and reported.

JIRA: YANGTOOLS-964
Change-Id: If9fe8da3235533a702a34ceac26d62d91acc03c3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 1e6da8dcec386c56a626d7982e20a67e35d8a4f7)
(cherry picked from commit 3e66f45b8e6dd5f6bf2014c2cba3adc61eed6c89)

5 years agoDefine IfFeature via a specialized class 49/80749/2
Robert Varga [Fri, 8 Mar 2019 14:04:34 +0000 (15:04 +0100)]
Define IfFeature via a specialized class

This reworks the grammar to use less recursion, as we can use
wildcards to eagerly combine expressions like "foo || bar || baz"
into any(foo, bar, baz) rather than or(foo, or(bar, baz)).

In order to properly support this contract, we define IfFeatureExpr,
which we specialize, so that we do not need to lug an opaque
predicate tree.

JIRA: YANGTOOLS-964
Change-Id: I048c3ced9c074e340031ac53c1117ce881b0a78b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 5874f5da6ff34f70c5754f5a98dbd0a32820fba1)
(cherry picked from commit 024e83fdfef852a995ba5d43e3f753cd391afd69)

5 years agoMake sure we populate features 48/80748/2
Robert Varga [Fri, 8 Mar 2019 17:38:04 +0000 (18:38 +0100)]
Make sure we populate features

The way features work with EffeciveModules means features are not
populated into FeatureNamespace. In fact that namespace is not
activated at all.

Fix this up, so features can be cross-referenced with if-feature.

Change-Id: I73cb4e8cf648e5f8ef72edce00556e4e69ee908c
JIRA: YANGTOOLS-964
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 33bc94f1abc68aebd26bc12ac1c085d6ba001eb9)
(cherry picked from commit 48922a50215c704a610e03ac1a1e5635d9dc257e)

5 years agoMake getIfFeaturePredicate() a default method 47/80747/1
Robert Varga [Fri, 8 Mar 2019 16:38:03 +0000 (17:38 +0100)]
Make getIfFeaturePredicate() a default method

This is just a reference to the argument, there is no point in
forcing implementations to deal with this.

Change-Id: I40cb0c349694f9fe9e224e4458fea2b2c05fa870
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit afae17b562f7ad0cdc9b844943dca045051f92d2)

5 years agoAdd YangInstanceIdentifier.createReverse(Deque) 46/80746/1
Robert Varga [Wed, 6 Mar 2019 10:39:13 +0000 (11:39 +0100)]
Add YangInstanceIdentifier.createReverse(Deque)

There are use cases when we need to instantiate a YangInstanceIdentifier
and we have the components available in a stack (i.e. deque). We can
provide an optimized instantiator which will walk the stack in reverse
order, reducing the need for one invert operation.

This patch adds two methods, one operating on a Deque<PathArgument>
and one operating on Deque<Object> with an extractor function.

Change-Id: If2b05d62dcbfb5d37415a2ecb241c8265ceb1be6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 4eb9273dfe708426f7cb3c5746f40b522ef08534)

5 years agoUse ForwardingNormalizedNodeStreamWriter for QName tranformation 74/80674/1
Robert Varga [Mon, 4 Mar 2019 12:56:05 +0000 (13:56 +0100)]
Use ForwardingNormalizedNodeStreamWriter for QName tranformation

We have a utility forwarder, which can be used as a baseline, reducing
transformation complexity a bit. Also make sure we reuse identifiers
when they are not transformed.

Change-Id: Ife4025cd47145b4501ff9f6186f47503cfb2aa45
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 29c7e09b2ea9aa387fd107314c2db6f3f5d9b4bb)

5 years agoFix ForwardingNormalizedNodeStreamWriter 69/80669/1
Robert Varga [Mon, 4 Mar 2019 12:34:56 +0000 (13:34 +0100)]
Fix ForwardingNormalizedNodeStreamWriter

Forwarding objects should allow all methods to be overridden, fix
that.

Change-Id: Ibb57fa99880914ffd2aff62b67e9e20ecadd4696
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 9e4bf58e9552bcd38fa5823a44a63df290a5ca7f)

5 years agoMake NormalizedNodeStreamWriter extensible 58/80658/1
Robert Varga [Thu, 28 Feb 2019 14:54:24 +0000 (15:54 +0100)]
Make NormalizedNodeStreamWriter extensible

NormalizedNodeStreamWriter needs to cater to at least one extension,
which is metadata emission. Introduce
NormalizedNodeStreamWriterExtension and add a getExtensions() method,
which returns no extensions by default.

JIRA: YANGTOOLS-497
Change-Id: Iebe11b80c3199f6b37b46c85bd7362a764de4ed6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 61759f1441b7480bc5a2b46bb8f15a5837809b8f)

5 years agoFix YangParserImpl streaming use 52/80652/2
Robert Varga [Thu, 28 Feb 2019 18:48:44 +0000 (19:48 +0100)]
Fix YangParserImpl streaming use

We should not be returning null, but "this", fix that.

Change-Id: I0683da43a4c1d0b30f8f7d0680be2aa17f4e05ec
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoAdd ExtensibleObject interface 50/80650/1
Robert Varga [Thu, 28 Feb 2019 15:10:14 +0000 (16:10 +0100)]
Add ExtensibleObject interface

This adds the basic ExtensibleObject and ObjectExtension interfaces,
which can be reused to define extensible objects.

Unlike a full-blown implementation, these interfaces provide only
access interface, not a mechanism to perform actual state attachment.

The attachment mechanism will be defined in future, when the need
for it actually arises.

JIRA: YANGTOOLS-497
Change-Id: Ie390b6174b8909c87595dddc0d467858f36ef8bf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 33e06bd2f202c270f70b99091029cb18afeb792a)

5 years agoRemove unneeded build-helper-plugin 96/80596/1
Robert Varga [Tue, 26 Feb 2019 09:51:53 +0000 (10:51 +0100)]
Remove unneeded build-helper-plugin

yang-parser-impl does not include any antlr sources, hence we do
not need to helper plugin anymore.

Change-Id: I0b1439a24afae1cb0733846226161d5482adb67d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 3676af83eaa43cb27466a0a3479e511d5cc225f2)

5 years agoFix ImmutableUnkeyedListNodeBuilder.valueEquals() 42/80342/1
Robert Varga [Thu, 14 Feb 2019 16:40:47 +0000 (17:40 +0100)]
Fix ImmutableUnkeyedListNodeBuilder.valueEquals()

Returning an empty Set from getValue() means that if we ever
encountered two instances of this class in comparison, their values
would fail to compare, as valueEquals() expects a List.

Fix this by returning ImmutableList.of() and codify that in the
return value.

Change-Id: I4301f4161648ea391f2e0a1e712e3f87c6dca33c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 25754bb0fdf91e8d48994f9c186e90f9f1901f5c)

5 years agoAdd ModificationPath.toString() 10/80310/1
Robert Varga [Wed, 13 Feb 2019 11:32:37 +0000 (12:32 +0100)]
Add ModificationPath.toString()

While we use ModificationPath internally only, having a toString()
on it is useful for debugging.

Change-Id: I516ae9a02f8467e67209c32ead5c7ccdcc20e146
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 098079dd4e4f335ae9648a668b852ac638818bd8)

5 years agoMake MinMaxElementsValidation type-safe 04/80304/1
Robert Varga [Wed, 13 Feb 2019 09:56:23 +0000 (10:56 +0100)]
Make MinMaxElementsValidation type-safe

Since SchemaAwareApplyOperation exposes underlying schema, we can
make MinMaxElementsValidation require a specific schema type, making
the code a bit simpler.

JIRA: YANGTOOLS-955
Change-Id: I00700d2b45f4163072d8c4d4c364bd8047e5b430
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRemove AlwaysFailOperation 96/80296/2
Robert Varga [Tue, 12 Feb 2019 12:39:25 +0000 (13:39 +0100)]
Remove AlwaysFailOperation

AlwaysFailOperation guards the case when we do not have a schema
context, which is exceeding rare and there is exactly one place
where we can check for null to detect non-presence of an operation.

Remove this implementation along with
NonApplyDelegatedModificationApplyOperation.

JIRA: YANGTOOLS-955
Change-Id: Id70814eced80dd80948a1a5601287977fa77cf12
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 17af607d25f82391ad6c3327113b20e215190e20)

5 years agoRemove unneeded Iterator.remove() overrides 75/80275/1
Robert Varga [Mon, 11 Feb 2019 14:23:06 +0000 (15:23 +0100)]
Remove unneeded Iterator.remove() overrides

Java 8 has retrofitted remove() to be a default method which
throws UnsupportedOperationException. Take advantage of this and
remove some of our code.

Change-Id: Ie4e4ac4ef947d5d65a3f5b80c249c21c35909f92
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 2b9105f4331b2ef49f068ff643448ea1a2e65f99)

5 years agoCleanup yang-data-impl nullness annotations 60/80260/1
Robert Varga [Wed, 6 Feb 2019 15:55:16 +0000 (16:55 +0100)]
Cleanup yang-data-impl nullness annotations

This migrates yang-data-impl to use JDT nullness annotations, expanding
use of @NonNull in return types.

JIRA: YANGTOOLS-907
Change-Id: I16869db150ce28a94df5f6e5b55b5cf0fa07c34c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 5e2ee5120180b2cff62a6e8c2a2c172fbc625817)

5 years agoSchemaAwareApplyOperation has getSchema() 58/80258/1
Robert Varga [Wed, 6 Feb 2019 01:13:22 +0000 (02:13 +0100)]
SchemaAwareApplyOperation has getSchema()

Obviously, if an ModificationApplyOperation knows abouts its schema
it should expose it through getSchema(). This allows us to concentrate
fields a bit.

Change-Id: I9656b28dfb32fe7951e3ccd32b43eabe4427929f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit fd5c52cfb196a8d1dd6d6f2fb94f9a395c28afa7)
(cherry picked from commit 69c70b11011bea78ed9410daac84545293fa3601)

5 years agoCorrect mandatory leaf enforcement 57/80257/1
Robert Varga [Mon, 11 Feb 2019 10:46:17 +0000 (11:46 +0100)]
Correct mandatory leaf enforcement

Previous patch broke mandatory leaf enforcement on operational
data store. This patch fixes the logic to again apply this check.

Change-Id: I7b5d6ea05fea0b4df60c8cde9075168a3fa18e9c
JIRA: YANGTOOLS-947
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 875459db2abd73cbe5c9977c421e923e2c428de3)
(cherry picked from commit f77edb880973abc42ebea45417f7fdaadffc2f2a)

5 years agoRemove MapModificationStrategy hack 60/80160/1
Robert Varga [Tue, 5 Feb 2019 02:07:37 +0000 (03:07 +0100)]
Remove MapModificationStrategy hack

MapModificationStrategy has special handling to deal with DataTrees
rooted at a MapEntryNode, which really papered over failure of
InMemoryDataTree to properly resolve its root strategy.

Fix up InMemoryDataTree to use ListEntryModificationStrategy instead
of MapModificationStrategy when it is rooted at a particular map
entry.

JIRA: YANGTOOLS-951
Change-Id: I2e0306d1bf88fcee517a32c5903dfa98c287eb2c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 39d6912a0df959abf070bcec53d2157f938eb7fc)

5 years agoSquash value-based ModificationStrategies 55/80155/3
Robert Varga [Mon, 4 Feb 2019 17:15:15 +0000 (18:15 +0100)]
Squash value-based ModificationStrategies

LeafSetEntryModificationStrategy and LeafModificationStrategy
share all of their codebase, rendering them useless. Remove them
and promote AbstractValueNodeModificationStrategy to a full
class.

JIRA: YANGTOOLS-941
Change-Id: I95f6d5eb106a003dee85028bc8bb0251a25a6130
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit d3ea78c642c428f640ab29f8f197a65e4c4477e1)

5 years agoRework DataNodeContainerModificationStrategy child tracking 56/80156/2
Robert Varga [Tue, 5 Feb 2019 11:11:05 +0000 (12:11 +0100)]
Rework DataNodeContainerModificationStrategy child tracking

Since we do not want to expand the entire modification tree, but
instantiate it lazily, we have used a Guava LoadingCache to load
children.

Unfortunately this has couple of disadvantanges, namely:
- memory overhead of the cache and its entries
- access through a ConcurrentHashMap
- synchronized entry loading

As it turns out, we can do much better by maintaining an immutable
map ourselves, with compare-and-swap locking. This results in
much lower memory overhead as well as fast access, as we perform
only a single volatile read in that case.

JIRA: YANGTOOLS-950
Change-Id: I7b8c6d6561d65373e54cf5a5dd9f0bc2537531ac
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoSeparate out ModificationApplyOperation.verifyStructure() 48/80148/4
Robert Varga [Thu, 31 Jan 2019 14:36:28 +0000 (15:36 +0100)]
Separate out ModificationApplyOperation.verifyStructure()

The boolean handling of this method makes it really two distinct
methods, quickVerifyStructure() and fullVerifyStructure().

Refactor them so that we have two separate invocation paths, which
meet in SchemaAwareApplyOperation and from there are properly
dispatched to subclasses.

This reduces the number of implementations and makes it much clearer
as to what the specific and shared logic is. Most notably it makes
fullVerifyStructure() have only three implementations and
quickVerifyStructure() becomes bimorphic.

JIRA: YANGTOOLS-947
Change-Id: Ife836c7b9011e97a421746efa575148b1e77f6e9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 20df7021c844ccf06d1378f615c2988fff60edee)

5 years agoMove NormalizedNode-based DataTreeCandidateNodes into API 47/80147/2
Robert Varga [Mon, 28 Jan 2019 21:17:54 +0000 (22:17 +0100)]
Move NormalizedNode-based DataTreeCandidateNodes into API

These utility classes are useful for downstreams, and we have
an API point from where we can expose them in a relatively clean
fashion.

Move them to API package and expose them through DataTreeCandidateNodes
utility class.

Change-Id: Idaa276323f78baa273200f8d8c6b77e53fa60c6a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit e8ac6b68244f35fce04f421314259ec8683652aa)

5 years agoSeparate out RootModificationApplyOperation 46/80146/1
Robert Varga [Thu, 31 Jan 2019 08:17:31 +0000 (09:17 +0100)]
Separate out RootModificationApplyOperation

RootModificationApplyOperation is an operation holder, which has
particular lifecycle and can give access to the current
ModificationApplyOperation.

Rename it to RootApplyStrategy and have it *not* a subclass of
ModificationApplyOperation. This makes the flow more consistent
as well as making it obvious the three classes constituing its
associated logic cannot every come up in the context of traversing
a modification tree.

JIRA: YANGTOOLS-949
Change-Id: I01061db38c6d631f804eef1b241a93eaf11626e5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit ec6ea0775906ed2355553aec917bb77933764ecd)

5 years agoOptimize IMDT tests 45/80145/1
Robert Varga [Mon, 28 Jan 2019 12:55:19 +0000 (13:55 +0100)]
Optimize IMDT tests

These tests are sharing a SchemaContext, do not set it up multiple
times but reuse it across runs.

Change-Id: If9e27ace5e0e3af966102019d57ef074aa652c5b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 9a54c14ce6741052d838e988dd8972271f7db2c4)

5 years agoAdd utility wrappers for instantiating builders/nodes 31/80131/2
Robert Varga [Tue, 29 Jan 2019 23:38:13 +0000 (00:38 +0100)]
Add utility wrappers for instantiating builders/nodes

This removes the need for subclasses of
AbstractNodeContainerModificationStrategy to provide separate
methods, moving through a dispatch class instead. This lowers
the number of potential implementations down to one, with
the functionality being supported by 2 distinct classes.

As it turns out, this refactor actually has no additional overhead,
because the support instance reference can completely supplant
the Class reference we are holding.

JIRA: YANGTOOLS-941
Change-Id: I53a26981d41fb0cc6dd71dffd4e1bd71f9e9387d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit c91afd55c080cf25473767536b4509ae3b5e2603)

5 years agoEliminate no-op MandatoryLeafEnforcer 46/80046/1
Robert Varga [Wed, 30 Jan 2019 12:49:40 +0000 (13:49 +0100)]
Eliminate no-op MandatoryLeafEnforcer

Running through a no-op enforcer, while efficient, still requires
a bimorphic invocation, which results most of the time in a no-op.

Eliminate the no-op implementation and refactor its two users, so
that they provide dedicated subclasses which use enforcer. This has
the benefit of not overriding SchemaAwareApplyOperation just to
run a noop invocation.

JIRA: YANGTOOLS-945
Change-Id: Iff44eb6efa048bb86a71b0d7753d3e58425b5e4d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 8dbd4934c7ed38b62a36a27322c663c6ddb45159)

5 years agoAdd Abstract{LeafSet,Map}ModificationStrategy 42/80042/1
Robert Varga [Wed, 30 Jan 2019 13:54:51 +0000 (14:54 +0100)]
Add Abstract{LeafSet,Map}ModificationStrategy

This allows us to remove some code duplication in constructor,
but notably share the implementation of getChild().

Furthermore it allows us to make the rooted-at-MapEntry hack work
consistently for ordered map nodes too.

JIRA: YANGTOOLS-946
Change-Id: Id91529c31341afd46a693f24eb1ac4ea0dc4800d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 73740a4c50094c722152883bd333e82961c4dd4c)

5 years agoConvert MinMaxElementsValidation to ModificationApplyOperation 38/80038/1
Robert Varga [Wed, 30 Jan 2019 17:12:03 +0000 (18:12 +0100)]
Convert MinMaxElementsValidation to ModificationApplyOperation

This removes the fragile piggy-backing onto SchemaAwareOperation,
as done as part of YANGTOOLS-909 and modifying it to take advantage
of DelegatingModificationApplyOperation. This allows us to hide
SchemaAwareApplyOperation's checkWriteApplicable().

Change-Id: I804ddb5e4c8b7562bde11994be8b1a5615228d7c
JIRA: YANGTOOLS-944
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoIntroduce DelegatingModificationApplyOperation 37/80037/1
Robert Varga [Wed, 30 Jan 2019 11:46:10 +0000 (12:46 +0100)]
Introduce DelegatingModificationApplyOperation

As it turns out implementations outside of SchemaAwareApplyOperation
can share implementations of most methods through delegation. Create
two new abstract classes, DelegatingModificationApplyOperation and
FullyDelegatedModificationApplyOperation which host partial and full
set of methods implemented as delegates.

FullyDelegatedModificationApplyOperation is used by AlwaysFailOperation
and RootModificationApplyOperation, as they the always-fail behaviour
is easily implemented through throwing ISE in delegate().

This eliminates 1-2 implementations of each ModificationApplyOperation
method.

Change-Id: I578769418baafb285593fefe8868e97e1d171157
JIRA: YANGTOOLS-944
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 37fe9edc082b151bc100537cfa567ba5998d453b)

5 years agoCleanup AbstractValueNodeModificationStrategy 33/80033/1
Robert Varga [Wed, 30 Jan 2019 13:31:16 +0000 (14:31 +0100)]
Cleanup AbstractValueNodeModificationStrategy

The implementation did not log offending values and reused
verifyStructure() to perform validation, making analysis difficult.

Refactor the value check so that it is in a private method invoked
from the three codepaths which need to perform it, making code flow
clearer.

Change-Id: I315899982c0f304e0459d5ad33a19e56af0d2355
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 59227494c2ba2ff1543874b32e69cd5f44d9d51c)

5 years agoFix automatic lifecycle delete stacking 28/80028/1
Robert Varga [Wed, 30 Jan 2019 15:39:35 +0000 (16:39 +0100)]
Fix automatic lifecycle delete stacking

Nodes with automatic lifecycle have the strange property that their
delete operations may actually stack with other operations.

Unfortunately delete operation itself has no semantics of having
underlying modifications, as it has no baseline to which to apply
them.

In order to fix this, we need to turn deletes into empty writes
for these constructs and once we are performing disappearing, undo
this trick. This effectively means that both empty writes and deletes
result in a delete operation, if they ended up modifying the tree,
or into a no-op if they did not.

JIRA: YANGTOOLS-938
Change-Id: I68b9f304e76d6b1bdb707f411a87cd6085ed8bc7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoOptimize StructuralContainerModificationStrategy.fakeMeta() 27/80027/1
Robert Varga [Wed, 30 Jan 2019 15:24:10 +0000 (16:24 +0100)]
Optimize StructuralContainerModificationStrategy.fakeMeta()

The container node we use for fakeMeta can easily be shared, which
improves our performance profile.

Change-Id: I5a7afc1ea9a9f66d7556e8e6b2b9ef79df9e5e57
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoUpdate junit link 79/79979/1
Robert Varga [Mon, 28 Jan 2019 16:36:53 +0000 (17:36 +0100)]
Update junit link

javadoc.io breaks with JDK11, update the link.

Change-Id: Ia3a1bb2905a0e55797514537f220332754515c1d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 9ecf2b5f7f3049ad7b7e2efca74d058c3d41899e)

5 years agoFix artifacts typo 07/79907/1
Robert Varga [Fri, 25 Jan 2019 11:14:28 +0000 (12:14 +0100)]
Fix artifacts typo

yangtools-docs is at the same version as yangtools, i.e. 2.0.17,
not 2.0.9.

Change-Id: I3d2473cee9d8b884931fc8a1960d992d2cd0d690
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 8dd2957dc9919df381b8c413600bdbb58823fcd3)

5 years agoFix yangtools-docs 06/79906/1
Robert Varga [Tue, 22 Jan 2019 15:34:20 +0000 (16:34 +0100)]
Fix yangtools-docs

Current docs fail to correctly deploy, fix that up. Also group
packages to make them more readable.

Change-Id: Iebf8c785ca0fd7968724759a2b593ca559620057
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit d15579af537c873f1b0e4f2954af6b5db962ba76)

5 years agoRework aggregate javadocs 05/79905/1
Robert Varga [Sun, 20 Jan 2019 23:48:17 +0000 (00:48 +0100)]
Rework aggregate javadocs

Since javadoc:aggregate-jar is forcing a full re-generate and compile
of the project, let's take a different approach.

This patch overloads the purpose of the docs directory so that it
participates on maven build. It produces a pom file with attached
sources and javadocs. Later we can add more stuff to it, too.

Change-Id: I866e8405e73f297c552194a7caf10c1fd8b26731
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 14372ca8ee0e2da543549143cba4eedb585530b6)

5 years agoAllow {Json,Xml}ParserStream to handle actions 73/79773/4
Robert Varga [Sun, 20 Jan 2019 18:25:12 +0000 (19:25 +0100)]
Allow {Json,Xml}ParserStream to handle actions

Generalize the support for RPCs to include actions, so that we can
use both. Also fix null handling to comply with javadoc.

Change-Id: Id84052c1d1f20aa9d0371015f01b0c8845152de2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 80ae3a4d7f12024341ef4900b4d672c17abd0262)

5 years agoAllow JSON/XML writers to be instantiated with root node 72/79772/3
Robert Varga [Sun, 20 Jan 2019 18:43:42 +0000 (19:43 +0100)]
Allow JSON/XML writers to be instantiated with root node

Rather than requiring a SchemaContext/SchemaPath combination, allow
writers to be instantiated by specifying a DataNodeContainer.

Change-Id: I9eb470587cad2af9b3390d134dcc03abc95e8645
JIRA: YANGTOOLS-935
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit aa37f2a86bfb4d04a99f78b1b0d892b3c0b76caf)

5 years agoRefactor implementations to hide XMLStreamWriter 71/79771/3
Robert Varga [Wed, 16 Jan 2019 15:23:21 +0000 (16:23 +0100)]
Refactor implementations to hide XMLStreamWriter

In order to have control over when we output an element, we need
to make sure we know how the writer is being used.

Refactor XMLStreamNormalizedNodeStreamWriter interaction with its
subclasses so we know when we are leaking the writer -- which
happens only in writeValue().

JIRA: YANGTOOLS-927
Change-Id: I7e7bd62016e994a31fe6d69995e9d088746359da
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 127cfbef06dec06721efc4fafe2e9ab551c644e6)

5 years agoBump versions for 2.0.17-SNAPSHOT 29/79729/1
Robert Varga [Sat, 19 Jan 2019 11:40:14 +0000 (12:40 +0100)]
Bump versions for 2.0.17-SNAPSHOT

This starts the next release development.

Change-Id: I0f19deaf1c7f1d12107f9880b834d63d1de9d8b7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoBump to odlparent 3.1.6 31/79631/1
Stephen Kitt [Thu, 17 Jan 2019 13:41:29 +0000 (14:41 +0100)]
Bump to odlparent 3.1.6

Change-Id: Id89e75d896a1f9863afec520f8dce47a6fe4eef6
Signed-off-by: Stephen Kitt <skitt@redhat.com>
5 years agoDo not write empty string in EmptyXmlCodec 90/79590/1
Robert Varga [Wed, 16 Jan 2019 21:38:04 +0000 (22:38 +0100)]
Do not write empty string in EmptyXmlCodec

Emitting an empty string does nothing but churn writer state,
so speed up EmptyXmlCodec by not touching the writer.

Change-Id: Iab7db37089b84ec1a3c2e3c9381265025e21fdca
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoFix default namespace emission 50/79550/1
Robert Varga [Tue, 15 Jan 2019 18:19:08 +0000 (19:19 +0100)]
Fix default namespace emission

When we are emitting opening a new element, we need to consult
XMLStreamWriter before we emit the element, otherwise its state
already reflects the newly-started element.

In non-repairing mode the JDK writer will accept our invocation
and update the namespace mapping, which will lead us to erroneously
assume we do not need to emit the declaration.

Since it is non-repairing, it will not emit the declaration itself,
leading to a blank document -- something for which we are actually
testing in one of our tests.

In order to improve the confidence in results, also update tests
which used only repairing factories to use both repairing and
non-repairing ones.

JIRA: YANGTOOLS-801
Change-Id: I6975cf21121f7a8f92056b5b49b31d53b685dc0f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 706aaed3e21eb3c5d080ee974f27b9348c3d2e92)

5 years agoImprove JAXP implementation compatibility 49/79549/1
Robert Varga [Tue, 15 Jan 2019 16:50:03 +0000 (17:50 +0100)]
Improve JAXP implementation compatibility

Testing with woodstox-core shows a couple of UT failures that
are really assumptions on the implementation. Address them so we
do not get failures when implementation changes (too much).

While we are at it, improve startsWith/contains string checks
by using hamcrest.

Change-Id: I4af0c9cc370e5699255725f049ee7bb9b5c171ac
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit fea3a6991aa892b676ab550393e944c3e6215ef3)

5 years agoAttach aggragate javadocs to aggragator 96/79096/1
Robert Varga [Mon, 24 Dec 2018 21:23:13 +0000 (22:23 +0100)]
Attach aggragate javadocs to aggragator

This allows us to point users to our aggregated javadocs, hence
they do not fish for them.

Change-Id: If191cdfd45c2732a96d4a62deb183f6add155a65
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 5319ee7804ebecd7bf022e2a1c1df117945834fa)

5 years agoShorten StatementMap$Regular.get(int) 56/79056/1
Robert Varga [Wed, 26 Dec 2018 02:36:03 +0000 (03:36 +0100)]
Shorten StatementMap$Regular.get(int)

We can use a trigraph instead of a if/return combo, saving an
instruction.

Change-Id: If1482da5a4cf83f87b4d995333d757d2fa2d7e12
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoFix StatementMap$RegularAsCollection's size 53/79053/2
Robert Varga [Wed, 12 Sep 2018 09:29:40 +0000 (11:29 +0200)]
Fix StatementMap$RegularAsCollection's size

We are not initializing the size field, hence the class does not
operate correctly. Fix that and correct isEmpty() method.

Change-Id: I1543e617f14f0a88c6b59afe93364cace151ee5c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit d94cd2529378a5544030c75bdb23b05d98092e05)

5 years agoCleanup RFC6020_YIN_NAMESPACE usage 49/79049/2
Robert Varga [Tue, 25 Dec 2018 22:29:08 +0000 (23:29 +0100)]
Cleanup RFC6020_YIN_NAMESPACE usage

In export write we really want to use RFC6020_YIN_NAMESPACE_STRING,
not RFC6020_YIN_NAMESPACE, making references proper constants.

Change-Id: I3e9c7c745fbd2dd97fcb35e47cdb0920a81cc596
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit a298f385bbb5a1ca9aeca03516bfac81c22bb1fd)

5 years agoFix noRev map efficiency 47/79047/2
Robert Varga [Tue, 25 Dec 2018 23:07:24 +0000 (00:07 +0100)]
Fix noRev map efficiency

QName.getRevision() always returns non-null, which means we are
always taking the slow version of this branch, as correctly flagged
by Eclipse.

Furthermore we can use QName.withoutRevision() to side-step QName's
localName validation, as the local name is known to have already
been checked.

Change-Id: I7be3b8053ab3dbddfdf9cf12f8754a307127a8b3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit e4aa6ef84602dfe47720fa6ebba8fff53bb6886f)

5 years agoSpeed up StatementContextVisitor.getValidStatementDefinition() 44/79044/2
Robert Varga [Tue, 25 Dec 2018 22:18:49 +0000 (23:18 +0100)]
Speed up StatementContextVisitor.getValidStatementDefinition()

Unprefixed statements are most common and we end up creating
a QNameModule each time we encounter them, while we have a common
constant which we can use.

Use the constant, allowing us to allocate fewer objects while
also allowing making interning work.

Change-Id: I9e8847f8bd39fb9bcf6f8d0e8b86d196aeb5e2cd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoBump versions to .16-SNAPSHOT 87/78987/1
Robert Varga [Fri, 21 Dec 2018 23:17:57 +0000 (00:17 +0100)]
Bump versions to .16-SNAPSHOT

This starts the 2.0.16 development iteration.

Change-Id: I36298775de0fa1e228f6386df17bc7ff3fe17b4e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoBump to odlparent 3.1.5 49/78949/2
Robert Varga [Fri, 21 Dec 2018 21:46:41 +0000 (22:46 +0100)]
Bump to odlparent 3.1.5

Change-Id: I9c0a3b8c3c4b2c3d03bb8e3df623d87cd70d724b
Signed-off-by: Stephen Kitt <skitt@redhat.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoAdd karaf distribution 74/78974/1
Robert Varga [Fri, 21 Dec 2018 18:30:47 +0000 (19:30 +0100)]
Add karaf distribution

This adds a karaf distribution for the purposes of validating
upstream (odlparent) packaging.

Change-Id: I0c01ebad2cad2e34407eae139cb6b2a2dc119d51
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit a0c2c8dee45b8fc2528d7d0e45461f215ca42b49)

5 years agoBump to odlparent-3.1.5-SNAPSHOT 73/78973/1
Robert Varga [Fri, 21 Dec 2018 21:43:33 +0000 (22:43 +0100)]
Bump to odlparent-3.1.5-SNAPSHOT

This bumps to current development version for validation purposes.

Change-Id: I39cdf113bae58184e7601dc160dc97554c1ca280
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoIntern empty leaves 87/78887/1
Robert Varga [Thu, 20 Dec 2018 09:43:09 +0000 (10:43 +0100)]
Intern empty leaves

This patch teaches LeafInterner to intern leaves holding Empty,
as they have only one possible value.

Change-Id: I5afa161ec49b02c33a3e7be28bcda135b6d796cb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoBump versions to 2.0.16-SNAPSHOT 38/78638/1
Robert Varga [Tue, 11 Dec 2018 09:29:37 +0000 (10:29 +0100)]
Bump versions to 2.0.16-SNAPSHOT

This starts the next development cycle.

Change-Id: Ibdcd4ded6a069a64899d52357efe64b4c175da4d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoPreserve attributes when parsing AnyXml from XML 79/78479/2
Jakub Morvay [Wed, 5 Dec 2018 16:29:38 +0000 (17:29 +0100)]
Preserve attributes when parsing AnyXml from XML

So far, anyxml nodes have been parsed in following pipeline:
 String -> DOM -> Stax -> String -> DOM
Now the parsing is simplified to:
 String -> DOM -> Stax -> DOM

Remove the unnecessary "back to string" step. This step is not just
unnecessary but also stripes down attributes and namespaces from AnyXml
node value.

JIRA: YANGTOOLS-923
Change-Id: If13ce9c7397c37b96a532090e67683a635ae14ef
Signed-off-by: Jakub Morvay <jmorvay@frinx.io>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 335359d23557e2b54b9df539eeaed8b97668a59e)

5 years agoAllocate new keyes map lazily 22/78322/2
Robert Varga [Thu, 29 Nov 2018 14:25:35 +0000 (15:25 +0100)]
Allocate new keyes map lazily

Do not allocate the map for new mappings until it is actually needed.
This introduces some additional complexity via null checks, but that
is not something major.

Also refactor large equals() method into smaller chunks, so that it
can be inlined more easily.

JIRA: YANGTOOLS-919
Change-Id: Idb4b7a4cb7cde09af2eab0bcebfb71083e64ff2f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 62876a059465a1c780eb88e9ef5f285f4a052ec2)

5 years agoBump versions to 2.0.14-SNAPSHOT 20/78120/1
Robert Varga [Sun, 25 Nov 2018 18:30:19 +0000 (19:30 +0100)]
Bump versions to 2.0.14-SNAPSHOT

This starts the next development iteration.

Change-Id: I14fd1f6e73edf822a5f250b8629aa48d6cfa1458
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoSeparate out ConstantArrayCollection iterator 16/78116/1
Robert Varga [Sun, 25 Nov 2018 16:59:50 +0000 (17:59 +0100)]
Separate out ConstantArrayCollection iterator

This splits it out into its own static class.

Change-Id: I94a86c65eefdba79db2f5ec3a01b13dbad0b41b0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoAdd predicate-free NodeIdentifierWithPredicates constructor 15/78115/1
Robert Varga [Sun, 25 Nov 2018 16:55:01 +0000 (17:55 +0100)]
Add predicate-free NodeIdentifierWithPredicates constructor

This saves some time and figuring out to users, as they can just
not specify any predicates and get a free list. This side-steps
some of the code done in the Map-taking constructor.

Change-Id: If06c50aad3c2918cc6ec150b4185837557ac3f40
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 6112dc1bfb6245584005509d5805afde661d9047)