yangtools.git
5 years agoRemove object cache declaration 18/80918/1
Robert Varga [Sat, 16 Mar 2019 00:26:55 +0000 (01:26 +0100)]
Remove object cache declaration

object-cache has been removed in 2.1.0, remove its declaration.

Change-Id: I3aaad19fd21a306f32d4f2b661564df40ab3fa36
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoHook if-feature statements onto FeatureNamespace 39/80739/7
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>
5 years agoRedefine if-feature statement in terms IfFeatureExpr 37/80737/4
Robert Varga [Fri, 8 Mar 2019 16:41:39 +0000 (17:41 +0100)]
Redefine if-feature statement in terms IfFeatureExpr

Rather than anonymizing the argument to a Predicate, use our custom
model of if-feature-expr.

JIRA: YANGTOOLS-964
Change-Id: Iaa3371691853a0f56216041314c8abbe88970669
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoDefine IfFeature via a specialized class 36/80736/4
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>
5 years agoMake sure we populate features 38/80738/3
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>
5 years agoMake getIfFeaturePredicate() a default method 35/80735/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>
5 years agoDisconnect AnnotationEffectiveStatement and AnnotationSchemaNode 33/80733/2
Robert Varga [Fri, 8 Mar 2019 08:07:12 +0000 (09:07 +0100)]
Disconnect AnnotationEffectiveStatement and AnnotationSchemaNode

These interfaces should be independent, make sure this is the case.
Also update AnnotationStatement with common accessors.

Change-Id: Ib59c5f99a36ecb3cf30d5a77e4dd539bf6b92277
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoAdd YANG Schema Mount parser support 30/80730/4
Robert Varga [Thu, 7 Mar 2019 19:18:21 +0000 (20:18 +0100)]
Add YANG Schema Mount parser support

This adds the necessary bits and pieces to properly support
mount-point extension in the parser.

JIRA: YANGTOOLS-965
Change-Id: I7ca1b6c8c961e3033dc8023089d9169573dc3c4e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoFix AnnotationStatement definition 31/80731/1
Robert Varga [Thu, 7 Mar 2019 20:37:13 +0000 (21:37 +0100)]
Fix AnnotationStatement definition

Annotation argument is required to be identifiers, which means their
argument really binds as a QName to the defining module. Change the
definition to reflect this fact.

This forces the argument to be validated properly as well as making
it easier to use.

Change-Id: Idca53d98517ab3627b4b555386bed6a740c3e66d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoAdd YangInstanceIdentifier.createReverse(Deque) 97/80697/3
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>
5 years agoEliminate ImmutableNormalizedNodeStreamWriter.getBuilders() 99/80699/2
Robert Varga [Wed, 6 Mar 2019 00:44:45 +0000 (01:44 +0100)]
Eliminate ImmutableNormalizedNodeStreamWriter.getBuilders()

The only caller is interested only in current container builder,
for which we already have a method.

Change-Id: I4ea7bc3d5dd6478b40ed1bd1c56b608650801a57
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoUpdate NormalizedMetadata(StreamWriter) design 89/80689/2
Robert Varga [Tue, 5 Mar 2019 15:13:38 +0000 (16:13 +0100)]
Update NormalizedMetadata(StreamWriter) design

While having a complete decomposition of metadata blocks would be
a nice design, it is not efficient for our current use:

- NormalizedMetadata has the block readily-available
- Both JSON and XML parsers fully assemble attributes before
  emitting them. Even if the implementation changes, both parsers
  can very easily assemble the full block, as XML encodes it just
  after the element and JSON uses dedicated objects.
- NETCONF edit-config processing requires metadata to be visible
  before it can decide how to process the node

This patch changes NormalizedMetadataStreamWriter have a single
metadata() event, which takes an ImmutableMap. This communicates
the intent quite clearly and allows for optimizations on both ends.

JIRA: YANGTOOLS-961
Change-Id: I638c78d5ab1d3a8b544ab53a84b872420b49d637
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoAdd RFC7952 data model extensions 43/80643/29
Robert Varga [Thu, 28 Feb 2019 12:48:56 +0000 (13:48 +0100)]
Add RFC7952 data model extensions

RFC7952 has implications on NormalizedNodeStreamWriter, namely
the ability to emit metadata attached to NormalizedNodes.

This patch introduces the concept of NormalizedMetadata, which
is the metadata counterpart to NormalizedNode. It also defines
NormalizedMetadataStreamWriter as an extension of
NormalizedNodeStreamWriter and implements NormalizedMetadataWriter,
which piggy-backs a NormalizedMetadata structure on top of a
NormalizedNode structure, so that the two are emitted as a single
event stream.

JIRA: YANGTOOLS-961
Change-Id: I8f1a69361d18cf5f9c14185778cca7c2d6ebc4f7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoAdd AnnotationSchemaNodeAware interface 81/80681/5
Robert Varga [Tue, 5 Mar 2019 09:32:15 +0000 (10:32 +0100)]
Add AnnotationSchemaNodeAware interface

It seems that having annotations indexed at the SchemaContext level.
To support that, add AnnotationSchemaNodeAware interface and make it
trivially implemented by SimpleSchemaContext.

Also retrofit AnnotationSchemaNode.find(SchemaContext) to recognize
AnnotationSchemaNodeAware and defer to the index if its available.

JIRA: YANGTOOLS-960
Change-Id: I1f3cd68a8356b20bceb2d0d620992ade10649e5b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRevert "Add NETCONF/RFC7952 compatibility" 82/80682/2
Robert Varga [Tue, 5 Mar 2019 10:01:15 +0000 (11:01 +0100)]
Revert "Add NETCONF/RFC7952 compatibility"

This reverts commit 0b86189513b25601ba12a4a38230017315914344, as
the relevant support needs to be provided by netconf project and
can be retrofitted via either decorating a SchemaContext, or
overriding the ietf-netconf.yang model.

JIRA: YANGTOOLS-961
Change-Id: I81d5a760703461fcc55b83b6caa95b69049299c3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoUse ForwardingNormalizedNodeStreamWriter for QName tranformation 67/80667/7
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>
5 years agoRework NormalizedNodeStreamWriter 62/80662/16
Robert Varga [Fri, 1 Mar 2019 13:05:52 +0000 (14:05 +0100)]
Rework NormalizedNodeStreamWriter

This patch reworks NormalizedNodeStreamWriter to issue start/end
events for even simple nodes, allowing attributes to be seamlessly
integrated into open nodes.

This necessitates some updates to serializers, which need to track
these simple nodes and properly handle endNode() events.

JIRA: YANGTOOLS-497
Change-Id: I9aa0979b778f54ce77be365b3ad8ba6690138df2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoFix ForwardingNormalizedNodeStreamWriter 66/80666/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>
5 years agoMake NormalizedNodeStreamWriter extensible 45/80645/9
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>
5 years agoAdd NETCONF/RFC7952 compatibility 48/80648/5
Robert Varga [Thu, 28 Feb 2019 15:52:40 +0000 (16:52 +0100)]
Add NETCONF/RFC7952 compatibility

RFC6241 pre-dates RFC7952 and defines an attribute which should
be modeled as a metadata annotation.

For legacy reasons, we are carrying support for this attribute
in yang-data-api, which does not quite fit the semantic model
and requires special-casing.

Since ietf-netconf.yang does not define the metadata annotation,
which would make RFC7952 work seamlessly, we need to hack this
around a bit and make the correspoding schema definition available.

JIRA: YANGTOOLS-961
Change-Id: Ib6c98e9bb8a7c9ae8351b61522c3fbfdd943393c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoFix YangParserImpl streaming use 47/80647/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 44/80644/3
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>
5 years agoRemove yang-model-immutable 33/80633/2
Robert Varga [Wed, 27 Feb 2019 15:47:52 +0000 (16:47 +0100)]
Remove yang-model-immutable

This is an unfinished component, remove it as it will need to be
reimplemented from scratch.

Change-Id: Ic55be7d3b66ea23d6a5363e1d6529542c394fb16
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRefactor yang-xpath-impl error handling 30/80630/3
Robert Varga [Wed, 27 Feb 2019 14:38:10 +0000 (15:38 +0100)]
Refactor yang-xpath-impl error handling

Separate out CapturingErrorListener and make sure we install it
in InstanceIdentifierParser.

Change-Id: I9313161708daa122854b423015bdbcffef369bda
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRemove generics from YangNumberExpr 26/80626/4
Robert Varga [Wed, 27 Feb 2019 14:22:23 +0000 (15:22 +0100)]
Remove generics from YangNumberExpr

Generics are only getting in the way with the class and its support,
remove them from interface classes and move them to
AbstractYangXPathMathSupport.

Change-Id: I81b69e88786db1ce014c4ee83b65c01da09fbdad
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoPropagate namespaceContext/mathSupport to FunctionSupport 23/80623/5
Robert Varga [Wed, 27 Feb 2019 12:50:00 +0000 (13:50 +0100)]
Propagate namespaceContext/mathSupport to FunctionSupport

A number of operations in Functions requires either mathSupport
or namespaceContext to work correctly. This patch makes sure it
is available.

Change-Id: Icdbf6eda25017f9c921d2009b52e1fa012d08033
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoUpdate yang-xpath-api design 19/80619/11
Robert Varga [Tue, 26 Feb 2019 21:14:28 +0000 (22:14 +0100)]
Update yang-xpath-api design

This is the first round of API design update, bringing the following
changes:
- MathMode is now a top-level enumeration
- YangXPathMathSupport is an API interface providing common functions
- Prefix resolution is done through YangNamespaceContext
- YangNaryExpr is final
- math-specific YangNumberExprs are hidden classes
- YangFunctionCallExpr.NoArgs is folded into YangFunctionCallExpr
- YangLiteralExpr is now final
- YangXPathExpression exposes MathMode
- Literal interpretation is lazy and works on subexpressions

Change-Id: Ie721678b5513dc088c1a267b98f38d9b0643cb33
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoAdd ModuleNameNamespaceContext 22/80622/2
Robert Varga [Wed, 27 Feb 2019 11:17:48 +0000 (12:17 +0100)]
Add ModuleNameNamespaceContext

This adds a utility YangNamespaceContext, which maps QNameModules
to their corresponding module name as contained in a SchemaContext.

Change-Id: I3be6316d0e7c1f9f98439e3bca3b9b0d385f63bb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoAdd YangNamespaceContext 18/80618/6
Robert Varga [Wed, 27 Feb 2019 08:35:18 +0000 (09:35 +0100)]
Add YangNamespaceContext

We require prefix/QNameModule mapping in multiple contexts, some
of which are bound to a SchemaContext, some of which are bound to
a particular Module.

This patch adds a generalized YangNamespaceContext to serve in these
situations and provides a simple BiMap-based implementation.

Change-Id: I3d44a55ea3569532395b3acb9dc7dedba70c1f4e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRemove ClassLoaderUtils.withClassLoader() 10/80610/2
Robert Varga [Tue, 26 Feb 2019 12:38:17 +0000 (13:38 +0100)]
Remove ClassLoaderUtils.withClassLoader()

These methods have disambiguated versions available and have been
deprecated. We now remove them.

Change-Id: I2f61c6ee56ace39a4597bf77bc348ff0ffc241b2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRemove ClassLoaderUtils.construct() 09/80609/2
Robert Varga [Tue, 26 Feb 2019 12:37:21 +0000 (13:37 +0100)]
Remove ClassLoaderUtils.construct()

This is a useless utility method, which is not used anywhere,
remove it.

Change-Id: Ia3c5cc2a6f61de86bb1b5ebe8f834b4c947a2ad7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoUpdate RequireInstanceRestrictedTypeBuilder type bound 08/80608/2
Robert Varga [Tue, 26 Feb 2019 11:53:19 +0000 (12:53 +0100)]
Update RequireInstanceRestrictedTypeBuilder type bound

Builder is defined only on top of RequireInstanceRestrictedTypeDefinition
instances, express that in generic type constraint.

Change-Id: I9394d2bb67b58527b14df37cd839c174434b6583
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRemove SchemaTracker.create(SchemaContext) 07/80607/1
Robert Varga [Tue, 26 Feb 2019 11:49:11 +0000 (12:49 +0100)]
Remove SchemaTracker.create(SchemaContext)

This method is superfluous, as it is a special case of
SchemaTracker.create(DataNodeContainer). Remove it.

Change-Id: Ieb5cda64d1b3bb730a29f6536bf3b70deaf9d7b5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRemove CompatUtils.compatLeafType() 06/80606/1
Robert Varga [Tue, 26 Feb 2019 11:44:40 +0000 (12:44 +0100)]
Remove CompatUtils.compatLeafType()

This method is superseded by compatType(), which handles both
LeafSchemaNode and LeafListSchemaNode.

Change-Id: I9af0349211a1be6b0a4873b78d8859020514e874
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRemove deprecated SchemaContextFactory methods 94/80594/1
Robert Varga [Tue, 26 Feb 2019 10:21:25 +0000 (11:21 +0100)]
Remove deprecated SchemaContextFactory methods

Specification of StatementParserMode and supported features has been
moved to SchemaContextFactoryConfiguration, now remove deprecated
compatibility methods.

Change-Id: I6e3710c0791527a0ab930f879550b447e1dd1490
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRemove deprecated SchemaRepository.createSchemaContextFactory() 88/80588/7
Robert Varga [Mon, 25 Feb 2019 15:54:59 +0000 (16:54 +0100)]
Remove deprecated SchemaRepository.createSchemaContextFactory()

Filter-based createSchemaContextFactory() has been deprecated, remove
it in the next major release.

Change-Id: I3033670b833cf3f6d5c7fc21fed7921255d516c6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRemove unneeded build-helper-plugin 93/80593/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>
5 years agoRefactor ListEntryNodeDataWithSchema 92/80592/3
Robert Varga [Mon, 25 Feb 2019 17:06:11 +0000 (18:06 +0100)]
Refactor ListEntryNodeDataWithSchema

This refactors ListEntryNodeDataWithSchema to contain to two
separate implementations, dealing with keyed and unkeyed lists
separately. Also retrofit AbstractNodeDataWithSchema to capture
SchemaNode type.

Change-Id: Id79e028866201fbf10871334f1fa3932d54c9f0f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRemove deprecated JsonParserStream methods 91/80591/1
Robert Varga [Mon, 25 Feb 2019 16:51:55 +0000 (17:51 +0100)]
Remove deprecated JsonParserStream methods

These methods have been deprecated for more than a year and have
better replacements, hence remove them.

Change-Id: I1ba83612ab1a5fc077c4fafaeb5e6b13dd5f1fbb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRemove deprecated JSONCodecFactory methods 89/80589/2
Robert Varga [Mon, 25 Feb 2019 16:01:07 +0000 (17:01 +0100)]
Remove deprecated JSONCodecFactory methods

These methods have been moved to JSONCodecFactorySupplier, remove
their deprecated definitions.

Change-Id: I78860c620155c80c02669e70b879ca30a75eb3a7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRemove deprecated yang.model.api.stmt constructs 90/80590/2
Robert Varga [Mon, 25 Feb 2019 16:10:06 +0000 (17:10 +0100)]
Remove deprecated yang.model.api.stmt constructs

This removes the various FooGroup and FooContainer interfaces,
inlining their definition in the corresponding declared statements.

Change-Id: I8a40fd8db97f5c424bad7d9250f8d8bb5459f7cc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoQName is a YANG identifier 73/80573/8
Robert Varga [Mon, 25 Feb 2019 12:53:39 +0000 (13:53 +0100)]
QName is a YANG identifier

Move argument enforcement to QName, as it is required to conform
to YANG identifier.

JIRA: YANGTOOLS-862
Change-Id: Ia1a5adb6921831476872d14e1e5c6caffc2af2d9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoMake ModuleEffectiveStatement.localQNameModule() mandatory 82/80582/3
Robert Varga [Mon, 25 Feb 2019 13:41:23 +0000 (14:41 +0100)]
Make ModuleEffectiveStatement.localQNameModule() mandatory

This removes an API design hack, so that we require localQNameModule()
to be implemented.

Change-Id: Ic152a358d2d3b4b758a41b09901a83e4d989ed61
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoHide ResourceYangTextSchemaSource 81/80581/3
Robert Varga [Mon, 25 Feb 2019 13:39:10 +0000 (14:39 +0100)]
Hide ResourceYangTextSchemaSource

Exposing a concrete subclass here makes the API design asymmetric,
because YinTestSchemaSource equivament is not exposed. Hide
ResourceYangTextSchemaSource.

Change-Id: I187a0c049cf885bdbc567ba20b55b4d278095198
JIRA: YANGTOOLS-849
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRemove RpcAsContainer 80/80580/3
Robert Varga [Mon, 25 Feb 2019 13:35:45 +0000 (14:35 +0100)]
Remove RpcAsContainer

This class is superseded by generalized OperationAsContainer, remove
it in this major release.

Change-Id: Icda0272fca7871e53134ef96cafbf185b148bf82
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoDocument StoreTreeNode.getChild() nullness 79/80579/3
Robert Varga [Mon, 25 Feb 2019 13:34:14 +0000 (14:34 +0100)]
Document StoreTreeNode.getChild() nullness

Null is not a valid argument, document a NPE being thrown when
a null is encountered.

Change-Id: I5d51ec5800a0f34a3a04123508d72f1acbe22db7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRemove ImplicitParentAwareStatementSupport inheritence 78/80578/4
Robert Varga [Mon, 25 Feb 2019 13:31:09 +0000 (14:31 +0100)]
Remove ImplicitParentAwareStatementSupport inheritence

Not all StatementSupports are ImplicitParentAwareStatementSupport,
make it an opt-in feature.

Change-Id: I98a1f3ff55c2f023e0806914409b1b5aef50e5a1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoMake NamespaceBehaviour.toString() final 77/80577/3
Robert Varga [Mon, 25 Feb 2019 13:27:06 +0000 (14:27 +0100)]
Make NamespaceBehaviour.toString() final

We are providing addToStringAttributes(), hence toString() should
be final to force consistency.

Change-Id: I40d9dbc355f257b2560c92c6f7a2145a311c8cfa
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoUpdate Unique{Constraint,EffectiveStatetement,Statement} design 76/80576/3
Robert Varga [Mon, 25 Feb 2019 13:24:21 +0000 (14:24 +0100)]
Update Unique{Constraint,EffectiveStatetement,Statement} design

The argument to 'unique' is required to be a set of relative paths,
rather than a plain collection. Reflect that in the design of these
interfaces.

Change-Id: I3a870fdf16897cfff52b46bfde946869d501560b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoDocument MutableTreeNode nullness assumptions 75/80575/3
Robert Varga [Mon, 25 Feb 2019 13:18:39 +0000 (14:18 +0100)]
Document MutableTreeNode nullness assumptions

This adds documentation specifying that a NPE is thrown when
a null argument is encountered.

Change-Id: Id830a1243964dea60e0ee4ecd2e209da4850816e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoUpdate ListenerRegistry design 74/80574/3
Robert Varga [Mon, 25 Feb 2019 13:08:49 +0000 (14:08 +0100)]
Update ListenerRegistry design

This addresses FIXMEs marked for 3.0.0 in ListenerRegistry,
including making it final.

Change-Id: I13939fe02fd6f086edc2c13b2f52b56980de9f80
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRemove RpcResultBuilderCompat 72/80572/3
Robert Varga [Mon, 25 Feb 2019 12:46:19 +0000 (13:46 +0100)]
Remove RpcResultBuilderCompat

This is an ABI compat class, remove it for next major release.

Change-Id: Id5054be7c4adfee26cd5358d167fc47376ef9149
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRemove javax.xml.parsers.ParserConfigurationException 71/80571/2
Robert Varga [Mon, 25 Feb 2019 12:43:25 +0000 (13:43 +0100)]
Remove javax.xml.parsers.ParserConfigurationException

We do not need to throw this exception, remove it.

Change-Id: I98e6d5ade172933b90ccca6f494e7019cb49d699
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoAdd StatementMap.toString() 90/80390/1
Robert Varga [Tue, 19 Feb 2019 10:36:27 +0000 (11:36 +0100)]
Add StatementMap.toString()

This aids debugging by adding value content, making it easier
to read what is actually in the map.

Change-Id: Ibc4025b34ae2d1485462360069b5ce095c8bc222
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoPrefer Immutable collections over Collections.emptyFoo() 37/80337/3
Robert Varga [Thu, 14 Feb 2019 16:47:37 +0000 (17:47 +0100)]
Prefer Immutable collections over Collections.emptyFoo()

Our immutable-checking logic works best on known classes, hence
we bias towards using ImmutableCollection-derived classes.

Change-Id: Ifdcfe3642f33b4ef050051b9cdbec74690740e37
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoFix ImmutableUnkeyedListNodeBuilder.valueEquals() 36/80336/2
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>
5 years agoDefang immutables.org 34/80334/1
Robert Varga [Thu, 14 Feb 2019 15:10:02 +0000 (16:10 +0100)]
Defang immutables.org

We do not want to leak annotations, so specify that in our style,
removing the need to suppress javax.annotation.

JIRA: YANGTOOLS-907
Change-Id: Ic363fc10e79336cd26274fb91d3791e3f8ba1334
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRefactor checkTouchApplicable() 08/80308/2
Robert Varga [Wed, 13 Feb 2019 11:52:14 +0000 (12:52 +0100)]
Refactor checkTouchApplicable()

We can remove direct overrides of checkTouchApplicable() by making
the method smarter in its checking of preconditions. Notably we
do not check TreeNode presence multiple times, but rather perform
a step-wise unpacking of state.

This has the benefit of having a clean place where we check if
automatic lifecycle is in effect and that happens only if the node
does not exist.

JIRA: YANGTOOLS-943
Change-Id: I72f4316c77d8f36efaf95209c36e898c9b4873cd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoAdd ModificationPath.toString() 07/80307/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>
5 years agoRemove checkApplicable() overrides 98/80298/2
Robert Varga [Tue, 12 Feb 2019 19:44:45 +0000 (20:44 +0100)]
Remove checkApplicable() overrides

The only time we are overriding checkApplicable() is in the TOUCH
case, which can more easily be handled through applyTouch().

Refactor AbstractNodeContainerModificationStrategy to include
the utility bits from AutomaticLifecycleMixin and move the override.
This reduces the number of implementations of checkApplicable()
from 7 to 2, while increasing the number of implementations of
checkTouchApplicable() from 3 to 7.

JIRA: YANGTOOLS-943
Change-Id: Iaf198ba852ff88d8e6b570b7c88b01f1064bb3a2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRemove DelegatingModificationApplyOperation 84/80284/1
Robert Varga [Tue, 12 Feb 2019 12:49:06 +0000 (13:49 +0100)]
Remove DelegatingModificationApplyOperation

MinMaxElementsValidation is the only subclass, hence merge the two
classes into one, making MinMaxElementsValidation type-safe through
use of the SchemaNode-generic of SchemaAwareApplyOperation.

Change-Id: I00700d2b45f4163072d8c4d4c364bd8047e5b430
JIRA: YANGTOOLS-955
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRemove AlwaysFailOperation 83/80283/1
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, making
MinMaxElementsValidation the only delegating implementation.

JIRA: YANGTOOLS-955
Change-Id: Id70814eced80dd80948a1a5601287977fa77cf12
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoExpand DataTreeCandidatesTest 78/80278/1
Robert Varga [Fri, 8 Feb 2019 13:01:18 +0000 (14:01 +0100)]
Expand DataTreeCandidatesTest

This expands the test suite with some assertions around merge
operations turning into unmodified nodes.

Change-Id: I385848837d01d3adc242661ddc50dc9098cd4f34
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRemove unneeded Iterator.remove() overrides 63/80263/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>
5 years agoExpand ImmutableNodes methods 61/80261/1
Robert Varga [Mon, 11 Feb 2019 11:24:48 +0000 (12:24 +0100)]
Expand ImmutableNodes methods

This performs an audit of the methods exposed as convenience
and makes sure QName-taking methods have their NodeIdentifier-taking
counterpart.

Change-Id: Iaea7e1da4f2b50b06c1af2f9204a85e0780c6a47
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoCleanup yang-data-impl nullness annotations 79/80179/4
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>
5 years agoCorrect mandatory leaf enforcement 54/80254/2
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>
5 years agoSchemaAwareApplyOperation has getSchema() 78/80178/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>
5 years agoRemove MapModificationStrategy hack 50/80150/6
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>
5 years agoRework DataNodeContainerModificationStrategy child tracking 52/80152/3
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 agoSquash value-based ModificationStrategies 35/80135/6
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>
5 years agoSeparate out ModificationApplyOperation.verifyStructure() 34/80134/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>
5 years agoMove NormalizedNode-based DataTreeCandidateNodes into API 73/79973/6
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>
5 years agoSeparate out RootModificationApplyOperation 59/80059/8
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>
5 years agoAdd utility wrappers for instantiating builders/nodes 43/80043/5
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>
5 years agoEliminate no-op MandatoryLeafEnforcer 22/80022/8
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>
5 years agoHide SchemaAwareApplyOperation.checkWriteApplicable() 40/80040/1
Robert Varga [Wed, 30 Jan 2019 17:20:39 +0000 (18:20 +0100)]
Hide SchemaAwareApplyOperation.checkWriteApplicable()

The refactor of MinMaxValidation allows us to optimize
checkWriteApplicable() by completely hiding it.

JIRA: YANGTOOLS-944
Change-Id: I804ddb5e4c8b7562bde11994be8b1a5615228d7c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoAdd Abstract{LeafSet,Map}ModificationStrategy 25/80025/3
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>
5 years agoCleanup AbstractValueNodeModificationStrategy 23/80023/3
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>
5 years agoIntroduce DelegatingModificationApplyOperation 20/80020/2
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>
5 years agoFix automatic lifecycle delete stacking 52/79952/12
Robert Varga [Mon, 28 Jan 2019 13:19:00 +0000 (14:19 +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 agoFix ModifiedNode.toString() 67/79967/1
Robert Varga [Mon, 28 Jan 2019 18:39:27 +0000 (19:39 +0100)]
Fix ModifiedNode.toString()

This method's return is extremely confusing, as it is reporting
logical operation instead of modification type and it hides behind
NodeModification, rendering identification hard.

Fix this by using ToStringHelper to make sure this works correctly.

Change-Id: I39907db8d260043809f68fc76c57a3bd5b922b0d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoUpdate junit link 58/79958/2
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>
5 years agoOptimize IMDT tests 51/79951/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>
5 years agoCleanup yang-parser-spi namespaces 52/68552/9
Robert Varga [Fri, 23 Feb 2018 15:25:29 +0000 (16:25 +0100)]
Cleanup yang-parser-spi namespaces

Statement-related namespaces should use proper type capture, so that
we get proper binding to effective statements.

JIRA: YANGTOOLS-852
Change-Id: I0096410ad87dd76be6f6301935a426a82df85ece
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRemove old YIN model exporter 25/79925/3
Robert Varga [Fri, 25 Jan 2019 13:03:53 +0000 (14:03 +0100)]
Remove old YIN model exporter

We have a new implementation for a could of releases, remove
the old one.

JIRA: YANGTOOLS-931
Change-Id: Ie3a6b6cadb803e60f5cef94d625e1c4d3ba67822
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoDo not generate listener interfaces 84/69084/5
Robert Varga [Mon, 5 Mar 2018 16:39:17 +0000 (17:39 +0100)]
Do not generate listener interfaces

We do not use antlr listeners anymore, do not generate them, saving
around 4K in the final .jar.

Change-Id: I0521080f71c53db7bc5d00410eabc005cff16da7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRemove odl-triemap and related code 03/79903/2
Robert Varga [Fri, 25 Jan 2019 11:03:39 +0000 (12:03 +0100)]
Remove odl-triemap and related code

This has been superseded by tech.pantheon.triemap, remove legacy
wrappers.

JIRA: YANGTOOLS-930
Change-Id: Ic93cef46ae75fcbcff10498e2383dfc6d1c3e0c2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoBump versions for yangtools-3.0.0 02/79902/1
Robert Varga [Fri, 25 Jan 2019 10:58:18 +0000 (11:58 +0100)]
Bump versions for yangtools-3.0.0

This starts the development of the next major release.

Change-Id: I2b2e0f7e339886f309d062895a49cff6ada0671d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoFix yangtools-docs 26/79826/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>
5 years agoRework aggregate javadocs 70/79770/7
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>
5 years agoRemove unneded artifacts entries 69/79769/1
Robert Varga [Sun, 20 Jan 2019 23:30:35 +0000 (00:30 +0100)]
Remove unneded artifacts entries

object cahce is a thing of the past, remove these stale
entries.

Change-Id: I3d81196819c291364b7dad2d53431b8f0024516c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoAllow {Json,Xml}ParserStream to handle actions 64/79764/2
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>
5 years agoAllow JSON/XML writers to be instantiated with root node 65/79765/2
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>
5 years agoBump version to 9-SNAPSHOT 59/79659/2
Robert Varga [Fri, 18 Jan 2019 14:42:20 +0000 (15:42 +0100)]
Bump version to 9-SNAPSHOT

This starts the next development cycle.

Change-Id: I0be6ec1cb52f2603c2d2d6077df26f9892d69495
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoBump to odlparent 4.0.9 58/79658/2
Stephen Kitt [Fri, 18 Jan 2019 13:50:35 +0000 (14:50 +0100)]
Bump to odlparent 4.0.9

Change-Id: Ie33ea4ef73069041ec5883c461f08ea31740d8c0
Signed-off-by: Stephen Kitt <skitt@redhat.com>
5 years agoRemove writeValue()'s IOException throws 55/79655/1
Robert Varga [Fri, 18 Jan 2019 12:08:07 +0000 (13:08 +0100)]
Remove writeValue()'s IOException throws

Neither implementation can throw an IOException, hence tighten
internal API contract.

Change-Id: I7e3fe5bebfae87f5130f85cd4f40c87061d528d1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoClean up XMLStreamWriterUtils 87/79587/5
Robert Varga [Wed, 16 Jan 2019 21:27:05 +0000 (22:27 +0100)]
Clean up XMLStreamWriterUtils

This is slight refactor propagating @NonNull annotations and
acting on them:
- we do not need to use String.valueOf()
- we do not need guard against null values
- ValueWriter is a nice place to have a utility for doing
  writeCharacters(obj.toString())

Change-Id: Idcbc24036c2ae07cf93481cba1a2e311db7def6f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoDelay calling writeStartElement() 82/79582/7
Robert Varga [Wed, 16 Jan 2019 16:29:52 +0000 (17:29 +0100)]
Delay calling writeStartElement()

Java's default XMLStreamWriter is rather bad at emitting self-closing
tags, in that it will not do that unless we explicitly call
writeEmptyElement().

This is rather unfortunate, as there is plenty of cases, where it's
the writer's job to realize the element should be self-closing, for
example in case it carries only attributes -- which we simply have
no way of driving through XMLStreamWriter.

In order to make this work, we need to delay the call to
writeStartElement() until we see the next event, which can end up
being writeEndElement() -- which is where when we need to use
writeEmptyElement() instead.

Since value serializers can end up emitting namespace declarations
and characters into the stream, we hide the writer behind two classes:

- ValueWriter, which is abstract class strictly for use by serializers
  and exposes minimal methods required for them
- StreamWriterFacade, which is the sole implementation of ValueWriter,
  which holds methods required by XMLStreamNormalizedNodeStreamWriter

StreamWriterFacade thus has visibility into activity of both call
sites and can make appropriate decisions.

JIRA: YANGTOOLS-927
Change-Id: Ib42d7662d0b9b648132e93bc4ea9fbe012104deb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoDeprecate XMLStreamNormalizedNodeStreamWriter.toString(Element) 88/79588/4
Robert Varga [Wed, 16 Jan 2019 22:16:33 +0000 (23:16 +0100)]
Deprecate XMLStreamNormalizedNodeStreamWriter.toString(Element)

This is an unused method, deprecate it for removal.

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