yangtools.git
14 months agoImprove EffectiveInstances.attachCopy() 34/105234/1
Robert Varga [Tue, 4 Apr 2023 21:44:52 +0000 (23:44 +0200)]
Improve EffectiveInstances.attachCopy()

Use local variable type inference to reduce code clutter.

Change-Id: I52d3450d87aefbd1ae3bb806fbfd37aee52c979f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoRemove an explicit cast from unmaskUndeclared() 33/105233/1
Robert Varga [Tue, 4 Apr 2023 21:41:43 +0000 (23:41 +0200)]
Remove an explicit cast from unmaskUndeclared()

Use an instanceof pattern to have the return readily-cast.

Change-Id: I253fc8848f828e76fb421a86430b490646bc1d9a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoImprove StatementContextBase.wrapWithOriginal() 32/105232/1
Robert Varga [Tue, 4 Apr 2023 21:28:17 +0000 (23:28 +0200)]
Improve StatementContextBase.wrapWithOriginal()

We can use local variable type inference to reduce warnings and also
instanceof pattern to remove an explicit cast.

Change-Id: I80572a5392b9a94ed46fa6fdf28cb4a21580995c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoModernize IfFeatureExpr 30/105230/2
Robert Varga [Tue, 4 Apr 2023 17:53:17 +0000 (19:53 +0200)]
Modernize IfFeatureExpr

Use local variable type inference to ditch some of the verbosity. Also
use a switch expression and add a few comments.

Change-Id: I2d1dd40028b00c756cd7e85a6b3086b6f0c63ed4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoImprove StmtContextUtils.checkFeatureSupport() 29/105229/1
Robert Varga [Tue, 4 Apr 2023 17:40:47 +0000 (19:40 +0200)]
Improve StmtContextUtils.checkFeatureSupport()

FeatureStatement is defined to have a IfFeatureExpr, bind directly to
it. This removes the dependency on Predicate, removes the need to
suppress warnings and allows the JVM to more aggressively optimize.

Change-Id: I2e9a0ed68298dd5e08738bba42a4fff0c97505a3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoModernize StmtContextUtils 28/105228/1
Robert Varga [Tue, 4 Apr 2023 17:39:58 +0000 (19:39 +0200)]
Modernize StmtContextUtils

Use local variable type inference to simplify code.

Change-Id: If693e1474ee9ac675400d1092840dfc8e0238e17
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoMigrate yang-model-ri to JUnit 5 96/105096/3
Robert Varga [Wed, 29 Mar 2023 08:40:58 +0000 (10:40 +0200)]
Migrate yang-model-ri to JUnit 5

This is a straightforward migration.

Change-Id: I7957e83e2bd47da07194dc207aa2fd221d8acedc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoMigrate yang-model-spi to JUnit5 95/105095/2
Robert Varga [Wed, 29 Mar 2023 08:34:28 +0000 (10:34 +0200)]
Migrate yang-model-spi to JUnit5

This is mostly a rewrite-driven migration.

Change-Id: Icb01d01d7cd3daa37fbdfff8b5cd932eb75e4c58
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoSimplify YangParserConfiguration.equals() 70/105070/1
Robert Varga [Mon, 27 Mar 2023 19:59:01 +0000 (21:59 +0200)]
Simplify YangParserConfiguration.equals()

Use an instanceof pattern to use a simple expression.

Change-Id: Idacf5673ccde383027edcc105da72fbafce9f2f4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoMigrate yang-model-util to JUnit5 54/104654/6
Robert Varga [Wed, 1 Mar 2023 11:43:31 +0000 (12:43 +0100)]
Migrate yang-model-util to JUnit5

This is an automated conversion, with migration away from Hamcrest where
useful.

Change-Id: I762d9e7b124e0b07511b847ee594e9386cae1f4d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoRemove 'throws IOException' declaration 09/105009/1
Robert Varga [Fri, 24 Mar 2023 12:27:46 +0000 (13:27 +0100)]
Remove 'throws IOException' declaration

This is a code smell reported by Sonar, fix it.

Change-Id: I0a4f2155f0fbf8f69ccd7bc4a1f25202b1fc4bbe
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoMigrate yang-model-api to JUnit5 86/104886/2
Robert Varga [Wed, 15 Mar 2023 13:10:00 +0000 (14:10 +0100)]
Migrate yang-model-api to JUnit5

This is a rather trivial migration.

Change-Id: I37f6d307a83967028c75dbfb4d57b86000f0a9f8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoOptimize StmtContextUtils.isMandatoryNode() 89/104889/1
Robert Varga [Wed, 15 Mar 2023 17:50:22 +0000 (18:50 +0100)]
Optimize StmtContextUtils.isMandatoryNode()

Use instanceof pattern and a switch expression to remove an explicit
cast and make the implementation less verbose.

Change-Id: Ic4800aac65469565f4aead71a740f96aa3d126bf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoRemove StmtContextUtils.getRootModuleQName() 88/104888/2
Robert Varga [Wed, 15 Mar 2023 17:27:35 +0000 (18:27 +0100)]
Remove StmtContextUtils.getRootModuleQName()

This method has been deprecated in previous release, remove it.

Change-Id: Id4e89f488c02cab92cefa224ebd4131b848524dc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoAdd an StmtContextUtils.getModuleQName() overload 87/104887/2
Robert Varga [Wed, 15 Mar 2023 17:25:42 +0000 (18:25 +0100)]
Add an StmtContextUtils.getModuleQName() overload

We have getRootModuleQName(), which unfortunately ends up polluting
returns with nulls. Add a getModuleQName(), which does not tolerate
null argument and therefore results in a non-null return.

Migrate users and depreate getRootModuleQName() for removal.

Change-Id: Ie28ef812cab87917fbe2b6eb07142c39b857fff1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoCheck requested schema tree statement namespace 97/104197/11
Sangwook Ha [Fri, 27 Jan 2023 22:24:14 +0000 (14:24 -0800)]
Check requested schema tree statement namespace

When we have a reactor when two children of an InferredStatementContext
differ only in namespace, we cannot blindly service
requestSchemaTreeChild().

Check whether the namespaces match, as we can only materialize
statements that match our targetModule.

JIRA: YANGTOOLS-1480
Change-Id: I4d9c6e6361fe2d5383e6de43e3c1bb54bac4e935
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoFix bits/instance-identifier value serdes 45/103945/18
Robert Varga [Fri, 6 Jan 2023 15:30:27 +0000 (16:30 +0100)]
Fix bits/instance-identifier value serdes

Bits and instance-identifier values need to be recognized. Fix their
serialization and parsing and enable tests.

JIRA: YANGTOOLS-1473
Change-Id: If5b40d4642e4d8353e8dfad492166987fc3c536b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
15 months agoFix identity-ref value parsing/serialization 44/103944/18
Robert Varga [Fri, 6 Jan 2023 15:30:27 +0000 (16:30 +0100)]
Fix identity-ref value parsing/serialization

When encountering a QName value in a leaf, a leaf-list or implied as the
value of a key, we need to properly encode it. The same is true when
parsing, where we have to consult current namespace mapping.

As a side-effect of this, we are also fixing the case of a leaf-list
entry referenced in a path argument -- which is important for all
non-String types.

JIRA: YANGTOOLS-1473
Change-Id: Id50ebd9a3c0c1378f1af8451b86c66e323757eba
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
15 months agoFix String value parsing/serialization 41/103941/24
Robert Varga [Fri, 6 Jan 2023 15:30:27 +0000 (16:30 +0100)]
Fix String value parsing/serialization

When encoding user-supplied values from user we need to be mindful of
their actual content: we cannot just use single quotes (') everywhere,
as the value itself can contain a single quote, in which case the
resulting string would have unbalanced quotes and nominally unparseable.

Adjust both sides of the serialization picture to account for this and
use YANG section 6.1.3 for escaping rules.

JIRA: YANGTOOLS-1473
Change-Id: I0df9beaf720a78682b6bde606a1359e7f1a09df8
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoUpdate test suite 73/104873/11
Robert Varga [Tue, 14 Mar 2023 07:49:38 +0000 (08:49 +0100)]
Update test suite

Change I6226cc8ebe48acc03a62309efec2ab205549e0fb has a few deficiencies
in the models and test consistency. Improve the tests before we start
addressing the issues.

JIRA: YANGTOOLS-1473
Change-Id: Ie1f4e5fa99a8258abe09c005d352dd971a98c051
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoImprove AbstractImmutableNormalizedNodeBuilder 66/104866/3
Robert Varga [Mon, 13 Mar 2023 22:48:19 +0000 (23:48 +0100)]
Improve AbstractImmutableNormalizedNodeBuilder

We are accessing fields twice, which elicits an Eclipse warning about
nullability. While this cannot really happen, as the fields cannot
become null once they have been non-null, we can improve the code by
essentially providing our alternative to checkState().

Change-Id: I9263cba1a2e9b46377556de423227ee02c003982
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoImprove ImmutableAnydataNodeBuilder null safety 65/104865/2
Robert Varga [Mon, 13 Mar 2023 22:47:39 +0000 (23:47 +0100)]
Improve ImmutableAnydataNodeBuilder null safety

Use a @NonNull annotation to fix an Eclipse warning.

Change-Id: Ibe8f8cf18c3ea7a402fac8e27c2a30b28604c6dc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoImprove OperationDefinition guarantees 82/104882/1
Robert Varga [Tue, 14 Mar 2023 20:11:39 +0000 (21:11 +0100)]
Improve OperationDefinition guarantees

We guarantee non-nullness across the board, use @NonNullByDefault
to express that.

Change-Id: I2838ff15dfe33384adc8a80a08add69200b7124c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoRemove baseline SchemaNode in AbstractContainerSchemaNode 81/104881/1
Robert Varga [Tue, 14 Mar 2023 20:09:08 +0000 (21:09 +0100)]
Remove baseline SchemaNode in AbstractContainerSchemaNode

Creating proxies without a backing store does not make sense: enforce
the invariant.

Change-Id: Idceec078783b9419d990cded38d18b7bbc002775
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoSimplify RpcContainerSchemaNode.getChildNodes() 80/104880/1
Robert Varga [Tue, 14 Mar 2023 19:58:02 +0000 (20:58 +0100)]
Simplify RpcContainerSchemaNode.getChildNodes()

RPC guarantees input and output being non-null, eliminate dead code
pointed out by Eclipse.

Change-Id: Ic8d0ed02bffbec7c66eeb63e964e17e8ac4a2a79
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoMake AbstractContainerSchemaNode generic 79/104879/1
Robert Varga [Tue, 14 Mar 2023 20:02:50 +0000 (21:02 +0100)]
Make AbstractContainerSchemaNode generic

This is a private superclass shared by two subclasses, which each store
the same object in an additional field. Make the superclass generic,
eliminating a field.

Change-Id: I27552291dd1f2d9bae45ba883ae6d28f28e78870
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoMigrate yang-data-util to JUnit5 76/104876/1
Robert Varga [Tue, 14 Mar 2023 13:50:39 +0000 (14:50 +0100)]
Migrate yang-data-util to JUnit5

This is mostly automated conversion, but also ditch
assertThat()/instanceOf() in favor of assertInstanceOf().

Change-Id: I4de1cb05a358cb694e2b68537179feeb08e76267
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoImprove XmlCodecFactory a bit 75/104875/1
Robert Varga [Tue, 14 Mar 2023 12:37:00 +0000 (13:37 +0100)]
Improve XmlCodecFactory a bit

Remove an unneeded cast in test code by exposing the fact that
instanceIdentifierCodec() operates on YangInstanceIdentifier.

JIRA: YANGTOOLS-1473
Change-Id: Ib915a0b4c93674e1e266359070bb6b06da20094c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoInline NamespaceStorageSupport.accessNamespaces() 56/104856/3
Robert Varga [Mon, 13 Mar 2023 18:26:21 +0000 (19:26 +0100)]
Inline NamespaceStorageSupport.accessNamespaces()

We have multiple callers, but all of duplicate the functionality
of getLocalNamespace(). Inline accessNamespaces() into
getLocalNamespace() and adjust users to use that instead duplicating its
code.

This removes a the need for a number of warning suppressions and makes
it clearer as to what is going on.

Change-Id: Ia210c6275b64093063eaf58a67412e94c3a29419
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoUse an instanceof pattern 55/104855/3
Robert Varga [Mon, 13 Mar 2023 18:21:06 +0000 (19:21 +0100)]
Use an instanceof pattern

InferredStatementContext uses check-and-cast, which we can simplify for
Java 17.

Change-Id: I7bba54874bd19ff0de79d665879003c82b3e8cac
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoUse local variable type inference a bit more 53/104853/1
Robert Varga [Mon, 13 Mar 2023 17:00:48 +0000 (18:00 +0100)]
Use local variable type inference a bit more

Reduce verbosity by using local variable type inference.

Change-Id: I8e02d0642b6e28052332a5f5dd5e9601442af8db
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoRemove a naked cast 52/104852/1
Robert Varga [Mon, 13 Mar 2023 17:00:07 +0000 (18:00 +0100)]
Remove a naked cast

We have a utility to perform a checked cast, use that instead to improve
defensiveness.

Change-Id: Id20c0690bc36ecd3eea0fc902c727d78450bdccd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoDo not emit phase in AbstractPathPrerequisite 43/104843/4
Robert Varga [Mon, 13 Mar 2023 14:48:56 +0000 (15:48 +0100)]
Do not emit phase in AbstractPathPrerequisite

This is always a constant, remove it from toString()

Change-Id: Ifc914d800093ad2d1084bc25466e92fde2ce7da2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoRemove AbstractPathPrerequisite.modPhase 42/104842/4
Robert Varga [Mon, 13 Mar 2023 14:47:01 +0000 (15:47 +0100)]
Remove AbstractPathPrerequisite.modPhase

AbstractPathPrerequisite always operates on EFFECTIVE_MODEL, inline
the constant, simplifying interactions a bit.

Change-Id: I916fef0f476969620a7cfc7010de30e9633eb72b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoEliminate ModelActionBuilder.requiresCtxPath() 41/104841/4
Robert Varga [Mon, 13 Mar 2023 14:41:58 +0000 (15:41 +0100)]
Eliminate ModelActionBuilder.requiresCtxPath()

There is only a single user of this method, which specifies
EFFECTIVE_MODEL argument, which the implementation hard-codes instead of
using the argument.

Introduce requiresEffectiveCtxPath() which makes the processing phase
implicit and inline the phase to prerequisite implementations.

Change-Id: I9072fe022600f0b24179aaad08c05cfcce2604e6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoFix augment/deviate mechanics 91/104291/5
Sangwook Ha [Mon, 30 Jan 2023 21:50:33 +0000 (13:50 -0800)]
Fix augment/deviate mechanics

Parsing of YANG models with a deviation fails if the deviation target
node is conditionally augmented based on a feature.

The problem is we are reusing are reusing setUnsupported() for two
cases: when the feature is not supported and when the target is not
available.

Separate the second case into a separate boolean, and if the target is
available, propagate children to target as unsupported -- which makes
namespace resolution work correctly and deviate properly sees the
children as unsupported.

JIRA: YANGTOOLS-1485
Change-Id: I954185dd0067667faae8073e222f07b65907e675
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoSimplify ModifierImpl.contextImpl() 44/104844/2
Robert Varga [Mon, 13 Mar 2023 15:04:36 +0000 (16:04 +0100)]
Simplify ModifierImpl.contextImpl()

Use an instanceof pattern to make the check we are making more
transparent.

Change-Id: If6d92be744e1e063f96feb7428c09c4984cf2c9a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoRehost file deletion 14/104814/1
Robert Varga [Thu, 9 Mar 2023 19:26:24 +0000 (20:26 +0100)]
Rehost file deletion

YangToSourceState is a simple DTO, but we really want to host some
utilities here. Wiping output files is one of them.

This also means we never deal with a null state, making
IncrementalBuildSupport simpler.

JIRA: YANGTOOLS-745
Change-Id: I6c5190275742c8518149cac70dfe7586f579e451
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoExecute yang-maven-plugin during incremental builds 12/104612/25
Robert Varga [Sun, 26 Feb 2023 20:36:02 +0000 (21:36 +0100)]
Execute yang-maven-plugin during incremental builds

We have all the bits and pieces to deal with incremental builds, enable
execution when just partial changes occur.

JIRA: YANGTOOLS-745
Change-Id: I0971d09476a0a5dcd842636fa61567e2d0ef05f9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoImprove FileState.ofFile() overheads 13/104813/1
Robert Varga [Thu, 9 Mar 2023 19:12:17 +0000 (20:12 +0100)]
Improve FileState.ofFile() overheads

We do not need the actual bytes read, hence we loop using a small-ish
buffer.

JIRA: YANGTOOLS-745
Change-Id: I2e35e3965c0a30a3d8368eeee45f5485a1765d29
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoIntegrate IncrementalBuildSupport 41/103141/71
Ruslan Kashapov [Tue, 8 Nov 2022 09:39:35 +0000 (11:39 +0200)]
Integrate IncrementalBuildSupport

IncrementalBuildSupport guides incremental/resumed execution, in that it
compares inputs to previous state as well as carefully updating output
to match the intended codegen output.

The process is sensitive to losing previously-generated files, but
allows persistent files to be updated. If some files magically
appear/disappear, we trigger a generation cycle.

JIRA: YANGTOOLS-745
Change-Id: I6f8cbf03a52542e8c20fd1383d459056272f951a
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoDefine FileGeneratorArg equality 12/104812/2
Robert Varga [Thu, 9 Mar 2023 18:07:42 +0000 (19:07 +0100)]
Define FileGeneratorArg equality

We are relying on equality to detect changes. Make sure that equality is
not identity.

JIRA: YANGTOOLS-745
Change-Id: I13b62b12ed9af7e80c4c3e883730b7e5e39e0240
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoFix CapturingOutputStream size accounting 11/104811/2
Robert Varga [Thu, 9 Mar 2023 18:02:02 +0000 (19:02 +0100)]
Fix CapturingOutputStream size accounting

Superclass bulk write method is off-loading to the single-byte write
method, leading to us seeing the size as double of what it is.

Rework the class so we forward methods directly, which has the added
benefit of improving performance.

JIRA: YANGTOOLS-745
Change-Id: I725a0771c807228b193eb1cea16abc5725cd70b1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoDelete previous output state on execution skip 09/104809/3
Robert Varga [Thu, 9 Mar 2023 15:47:57 +0000 (16:47 +0100)]
Delete previous output state on execution skip

Address two FIXMEs related to wiping actual state: when there are no
input files or no code generators, we should be wiping all of our
previous state.

JIRA: YANGTOOLS-745
Change-Id: Iaf1a7d9d3f8993af75ace5b8092c5e3c2f6f2bde
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoDitch use of Files.createParentDirs() 10/104810/2
Robert Varga [Thu, 9 Mar 2023 15:54:31 +0000 (16:54 +0100)]
Ditch use of Files.createParentDirs()

We have Files.createDirectories() which has a tad nicer behaviour,
use that instead of a Guava utility.

JIRA: YANGTOOLS-745
Change-Id: I766469340fe8628ed70a2dd933c89191f661f70f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoMove model addition out of the loop 08/104808/1
Robert Varga [Thu, 9 Mar 2023 14:32:27 +0000 (15:32 +0100)]
Move model addition out of the loop

Normalized names for YANG files in the project should be output outside
of the per-generator task.

JIRA: YANGTOOLS-745
Change-Id: Id15d9ba6a5786eb54fb39d0c9f50c62672df82f0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoCompare existing and generated output 07/104807/3
Robert Varga [Thu, 9 Mar 2023 13:08:20 +0000 (14:08 +0100)]
Compare existing and generated output

Before we overwrite a particular file we need to make sure that update
is actually needed. This adds the smarts to suppress such modifications
and notify BuildContext only when things change.

JIRA: YANGTOOLS-745
Change-Id: I17760f3342112343cd67f248d6374fd37710284d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoSimplify DEFAULT_PARSER_FACTORY instantition 99/104799/4
Robert Varga [Tue, 7 Mar 2023 23:17:54 +0000 (00:17 +0100)]
Simplify DEFAULT_PARSER_FACTORY instantition

Use a plain assignment in a try/catch block. This favors the usual
case of no problem at instantiation.

Change-Id: I04b56aac2feae11078c5ca4bc42aa010cbf0cce0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoSimplify YangProvider 98/104798/2
Robert Varga [Tue, 7 Mar 2023 23:10:53 +0000 (00:10 +0100)]
Simplify YangProvider

This is a stateless abstract class. Turn it it into a simple functional
interface and move the default implementation to YangToSourcesProcessor,
simplifying test invocations.

Change-Id: Iaaf1d76092bc3a52d7364363a2852309e44f9648
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoEliminate YangProvider.setResource() 97/104797/1
Robert Varga [Tue, 7 Mar 2023 22:48:07 +0000 (23:48 +0100)]
Eliminate YangProvider.setResource()

ProjectFileAccess is a better place for this method, as it pertains
to a Project and we are already doing the same thing there.

The result is a bit better integration with YangToSourcesProcessor.

JIRA: YANGTOOLS-745
Change-Id: I768d49271a24ef93c4b6b9136cc7d276a83eaed2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoRemove GeneratedDirectories 96/104796/1
Robert Varga [Tue, 7 Mar 2023 22:28:31 +0000 (23:28 +0100)]
Remove GeneratedDirectories

GeneratedDirectories is useless as a separate object because its
instance methods have a single caller site. Inline the users, so we
remove one level of indirection.

This exposes the duplication of "generated-sources" name, which needs to
be further centralized, depending on how things pan out looking.

JIRA: YANGTOOLS-745
Change-Id: Ie7706cda2a661c6c1c7983e0edc67826dc21ee06
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoMerge GeneratorTask(Factory) 95/104795/3
Robert Varga [Tue, 7 Mar 2023 21:39:10 +0000 (22:39 +0100)]
Merge GeneratorTask(Factory)

GeneratorTask is hidden behind a mostly-useless factory, merge the two
concepts to simplify interactions. This enables us to better integrate
with build cycle.

JIRA: YANGTOOLS-745
Change-Id: I30db56e60c69ee2893999e41764ca6a6071e632b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoEncapsulate GeneratorTask 94/104794/2
Robert Varga [Tue, 7 Mar 2023 21:33:13 +0000 (22:33 +0100)]
Encapsulate GeneratorTask

The distinction between GeneratorTask and GeneratorTaskFactory is very
moot. Simplify the interface to YangToSourcesProcessor, which enables us
to merge the two classes.

JIRA: YANGTOOLS-745
Change-Id: I672b3f0bc420baccfd8d7601c7420fd1b6bebcab
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoRemove ParserConfigAware 93/104793/1
Robert Varga [Tue, 7 Mar 2023 21:26:31 +0000 (22:26 +0100)]
Remove ParserConfigAware

This is a useless indirection, of which one implementation is completely
unused. Remove it, paving the way for further simplification.

JIRA: YANGTOOLS-745
Change-Id: Ie6084a2ef1afee68d9f8f4cc5bec9a9b8a356d8e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoEncapsulate project directory access 92/104792/3
Robert Varga [Tue, 7 Mar 2023 20:47:37 +0000 (21:47 +0100)]
Encapsulate project directory access

The access fact that a GeneratorTask has accessed a particular project
directory needs to be mediated. Add ProjectFileAccess to act as an
intermediary, so that the fact we generate files and Project
modifications can be disconnected.

JIRA: YANGTOOLS-745
Change-Id: Ib550a9c30936444a0077b6f08a3f1e85184173a3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoDo not use optional in createReactor() 91/104791/1
Robert Varga [Tue, 7 Mar 2023 18:29:45 +0000 (19:29 +0100)]
Do not use optional in createReactor()

We only ever return non-empty, codify that fact.

JIRA: YANGTOOLS-745
Change-Id: I25c2d791f024a44bcf0417379dfb30951393ef32
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoDo not pass BuildContext to GeneratorTask 90/104790/1
Robert Varga [Tue, 7 Mar 2023 18:21:20 +0000 (19:21 +0100)]
Do not pass BuildContext to GeneratorTask

We have previously decomposed OutputStream creation and refresh
notification. Now move the refresh notification processing to
YangToSourcesProcessor.

This improves the plugin in that:
- WriteTask is simpler (and smaller in some runtimes)
- BuildContext interactions are more localized
- BuildContext executes on the initial thread, improving its
  confinement

JIRA: YANGTOOLS-745
Change-Id: Ia192dbe5134349a78f2290bbf7a9b7ff9d236746
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoInline generateSources() 89/104789/1
Robert Varga [Tue, 7 Mar 2023 18:07:36 +0000 (19:07 +0100)]
Inline generateSources()

This method has direct interactions with output collection. We are set
to change that integration and this inlining has the added benefit of
removing one intermediate collection.

JIRA: YANGTOOLS-745
Change-Id: Ice993375011fd31a3ec80771b0a3d056b921cb68
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoObsolete Sodium SR1 streams 51/102951/8
Robert Varga [Fri, 28 Oct 2022 23:03:27 +0000 (01:03 +0200)]
Obsolete Sodium SR1 streams

We nominally support reading Sodium SR1 streams, but do not support writing
them out.

JIRA: YANGTOOLS-1492
Change-Id: Iec194a9f411f926996175781eeeb770a5f6884a3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoObsolete Neon SR2 streams 50/102950/7
Robert Varga [Fri, 28 Oct 2022 22:44:28 +0000 (00:44 +0200)]
Obsolete Neon SR2 streams

We nominally support reading Neon SR2 streams, but do not support writing
them out.

JIRA: YANGTOOLS-1492
Change-Id: Ia4655366357ce68f9dd18492f77c1f297658d26d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoObsolete Lithium streams 49/102949/4
Robert Varga [Fri, 28 Oct 2022 22:33:55 +0000 (00:33 +0200)]
Obsolete Lithium streams

We nominally support reading Lithium streams, but do not support writing
them out.

JIRA: YANGTOOLS-1492
Change-Id: Ibb820b5ee19ccb188dd1d0603eefe5133e1ff403
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoAdd AbstractQName.unbind() 08/104208/4
Robert Varga [Tue, 31 Jan 2023 22:43:44 +0000 (23:43 +0100)]
Add AbstractQName.unbind()

Acquiring a simple, namespace-free UnresolvedQName.Unqualified is
usefule in a few contexts, where we for convenience now require
AbstractQName (and document we only use its localName).

Introduce AbstractQName.unbind(), which returns an Unqualified object,
so that these users can be more expressive and can use direct equals
comparisons.

Change-Id: I1a485e05d2bb13c2012fc017a6b30795a8891a80
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoMove QNameAwareData{Input,Output} 78/104778/1
Robert Varga [Mon, 6 Mar 2023 14:55:42 +0000 (15:55 +0100)]
Move QNameAwareData{Input,Output}

Having these interfaces in QName makes it harder to interact with QName,
as they end up being completed into context where we have static
methods.

Change-Id: I8bf3e5bf8f414fcbee60b7120f7ccb7a9acedc33
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoRemove getLocalName() invocation 77/104777/1
Robert Varga [Mon, 6 Mar 2023 14:50:56 +0000 (15:50 +0100)]
Remove getLocalName() invocation

We can easily refer to localName field, do just that.

Change-Id: I0b51e77c1b5e2fe61b3190bc661541682dec8e4b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoUpdate YangData(Effective)Statement definition 20/104720/6
Robert Varga [Thu, 2 Mar 2023 13:02:05 +0000 (14:02 +0100)]
Update YangData(Effective)Statement definition

Using a raw String is not nice for end users, who want to corelate
this statement to other constructs. Change the argument definition
to YangDataName.

JIRA: YANGTOOLS-1479
Change-Id: I0b7788d9c6c9736ddac466c9c63a3cc05b6c92f9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoImprove SchemaInferenceStack javadocs 74/104774/3
Robert Varga [Mon, 6 Mar 2023 14:06:04 +0000 (15:06 +0100)]
Improve SchemaInferenceStack javadocs

Use {@code blocks} to highlight null/true/false. Also fix a tiny typo.

Change-Id: I531de055f437c0633bc7353c6d023a797f386323
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoIntegrate rfc7952-data-util into yang-data-util 67/104667/2
Robert Varga [Wed, 1 Mar 2023 15:24:44 +0000 (16:24 +0100)]
Integrate rfc7952-data-util into yang-data-util

Metadata is very much part of what YANG models, there is no need to keep
it in a separate package. This also allows for better integration.

JIRA: YANGTOOLS-1489
Change-Id: Ie3440b85621e905bec7bd24573ce7950ce35f790
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoMigrate yang-maven-plugin to JUnit5 40/104640/1
Robert Varga [Wed, 1 Mar 2023 09:33:12 +0000 (10:33 +0100)]
Migrate yang-maven-plugin to JUnit5

A straightforward rewrite + customized cleanups.

Change-Id: Ibc92482edfa6f598f5d4ad446ffa9dd1cd2a03ba
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoRename UtilTest 36/104636/1
Robert Varga [Tue, 28 Feb 2023 23:48:19 +0000 (00:48 +0100)]
Rename UtilTest

Leftovers are only testing ContextHolder, rename the test to reflect
that.

Change-Id: Ia8c55bde02ece03e5b37c0c1e684061d07511e14
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoRehost checkClasspath() 35/104635/2
Robert Varga [Tue, 28 Feb 2023 23:41:39 +0000 (00:41 +0100)]
Rehost checkClasspath()

This is a single-use utility method, move it to its sole user.

Change-Id: Icb5aec7e488b479bcad0c8e046d61cb4c5ec9ed1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoClean up getPluginTransitiveDependencies() 34/104634/2
Robert Varga [Tue, 28 Feb 2023 23:32:19 +0000 (00:32 +0100)]
Clean up getPluginTransitiveDependencies()

Allocate the return map inside the method, reducing the number of
arguments and actually returining it.

Change-Id: I482251d2abd353ece9386040acfe614bce70d582
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoMove Util.getClassPath() 33/104633/1
Robert Varga [Tue, 28 Feb 2023 23:27:39 +0000 (00:27 +0100)]
Move Util.getClassPath()

Rehost this utility method to its sole caller.

Change-Id: I51826631db782a5e85c37f6b776caa93e97a485f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoClean up yang-maven-util Util 32/104632/1
Robert Varga [Tue, 28 Feb 2023 23:21:39 +0000 (00:21 +0100)]
Clean up yang-maven-util Util

Use variable type inference and perform general clean up.

Change-Id: I415d4c91347c7b43eaf3afe6893408241a3504eb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoFixup listFiles() 31/104631/1
Robert Varga [Tue, 28 Feb 2023 21:10:27 +0000 (22:10 +0100)]
Fixup listFiles()

Use ImmutableList for return to make interactions clear.

Change-Id: I8e3955b99913b5286541d78e926584e9b004aa23
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoCapture input files in YangToSourcesState 27/104627/6
Robert Varga [Tue, 28 Feb 2023 17:06:44 +0000 (18:06 +0100)]
Capture input files in YangToSourcesState

We need to hash the files we use for input into the
EffectiveModelContext, so we can compare them when we next run.

This patch does not completely deal with the dependencies, as they are a
tad more complicated.

JIRA: YANGTOOLS-1165
Change-Id: Id2d3154d564918e2ee37d4de71f336863afc7da1
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoImprove generateSources() a bit 30/104630/1
Robert Varga [Tue, 28 Feb 2023 18:51:16 +0000 (19:51 +0100)]
Improve generateSources() a bit

Use local variable type inference to directly bind to ArrayList.

Change-Id: I832bbb2904ec85b24f233848aae756e9be46fe5b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoDo not instantiate allFiles 29/104629/1
Robert Varga [Tue, 28 Feb 2023 18:07:09 +0000 (19:07 +0100)]
Do not instantiate allFiles

We are just performing a simple check -- we can do that via
concatenating two streams instead.

Change-Id: I28ae2c6854bfc40007d6dc6c80a83ead99718965
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoClean up ScannedDependency 28/104628/1
Robert Varga [Tue, 28 Feb 2023 17:34:37 +0000 (18:34 +0100)]
Clean up ScannedDependency

Promise ImmutableList and use ImmutableSet internally, streamlining some
of the operations.

Change-Id: Iabcaef402a4cad284171a4acbcd99e4d48432a14
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoClean up YangProvider a bit 26/104626/1
Robert Varga [Tue, 28 Feb 2023 16:38:48 +0000 (17:38 +0100)]
Clean up YangProvider a bit

Use pre-sized builder and do not store the file name, as we are using it
exactly once.

Change-Id: I602b2b0b5db27c3a80096bc65055bc39d19c257c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoAdd file-based StateStorage 25/104625/4
Robert Varga [Tue, 28 Feb 2023 15:18:35 +0000 (16:18 +0100)]
Add file-based StateStorage

For plain maven builds, backed by DefaultBuildContext, we need to deal
with the fact the context does absolutely nothing. Add a file-based
storage engine.

Since we are persiting YangToSourcesState, also guard it with a magic
integer to allow for compatibility.

JIRA: YANGTOOLS-1491
Change-Id: I2763fbddf5a485ec4220e89c5fdc97f2a11f208f
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoAdd StateStorage 24/104624/3
Robert Varga [Tue, 28 Feb 2023 15:16:15 +0000 (16:16 +0100)]
Add StateStorage

The task of storing and restoring YangToSourceState can be filled
by multiple means. Add StateStorage interface and a simple
implementation based on BuildContext.

JIRA: YANGTOOLS-745
Change-Id: I2bc53ade834b140a429be9d7dcc9e6aba078d66f
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoRemove a warning suppression 22/104622/1
Robert Varga [Tue, 28 Feb 2023 13:29:00 +0000 (14:29 +0100)]
Remove a warning suppression

We can use FileGeneratorException as the precise exception, keeping
checkstyle happy.

Change-Id: Iaa8218d1e4c669384c3682c7bd0e7000ef7389f0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoFix a raw type suppression 21/104621/1
Robert Varga [Tue, 28 Feb 2023 13:26:25 +0000 (14:26 +0100)]
Fix a raw type suppression

We can operate on a simple wildcard, just to that.

Change-Id: I6eb1dadefad849b18cf84285ebf86920805cda66
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoClean up YangToSourcesMojo 20/104620/1
Robert Varga [Tue, 28 Feb 2023 13:05:29 +0000 (14:05 +0100)]
Clean up YangToSourcesMojo

We have a weird combination of injected and instantiated processors
here, which really serves only for a very bad UT. Since we are testing
YangToSourcesMojo through integration tests, we can forgo all of this.

This leads to a more straightforward execution, as now the Mojo acts
only as a thin interface towards maven. All the logic is contained in
Processor.

Change-Id: Ia64e69ed6a44e3052f43dcc978e066b080928e73
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoFix yang.skip implementation 19/104619/1
Robert Varga [Tue, 28 Feb 2023 12:43:23 +0000 (13:43 +0100)]
Fix yang.skip implementation

The documentation implies yang.skip disables execution completely, which
is in-line with other Maven plugins' skip function. Fix the
implementation to completely forgo execution.

Change-Id: I1cd58a73dd2c9e1f6f5c42a27de149079bb9175b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoTrack META-INF/ files in state 20/103220/25
Ruslan Kashapov [Tue, 8 Nov 2022 09:39:35 +0000 (11:39 +0200)]
Track META-INF/ files in state

Yang resources copied into META-INF folder now taken into
account as plugin output the same way as generated files.

JIRA: YANGTOOLS-1166
Change-Id: I815c1fc69c1220ce86efd319725470f11533c72b
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
15 months agoCapture effective configuration 11/104611/1
Robert Varga [Sun, 26 Feb 2023 19:53:53 +0000 (20:53 +0100)]
Capture effective configuration

We are filling in missing and ignoring unreferenced configurations,
make sure we capture the effective configuration.

JIRA: YANGTOOLS-1490
Change-Id: I24c14cecb4c19b9948b03d4b7ced485bd14b4e70
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoCapture FileGeneratorArg configuration 10/104610/1
Robert Varga [Sun, 26 Feb 2023 18:57:07 +0000 (19:57 +0100)]
Capture FileGeneratorArg configuration

Generator configuration constituates a part of parsisted state, make
sure we take it into account.

JIRA: YANGTOOLS-1490
Change-Id: Idaf53af87a1922e9f3ee93712f2c069f21ac8f67
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoDiscover the common prefix in a FileStateSet 09/104609/3
Robert Varga [Sun, 26 Feb 2023 17:55:35 +0000 (18:55 +0100)]
Discover the common prefix in a FileStateSet

Address a TODO that potentially improves persisted file size. This
makes FileState not a WritableObject, as the serialization format
requires further information.

JIRA: YANGTOOLS-1166
Change-Id: I35f7044186ac1e862a41e4f4a903fba2417cbb23
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoSeparate out FileStateSet 88/104588/2
Robert Varga [Sun, 26 Feb 2023 17:31:56 +0000 (18:31 +0100)]
Separate out FileStateSet

YangToSourcesState is mucking with maps, where this functionality will
be shared with another set of files. Split the functionality out to a
separate construct.

JIRA: YANGTOOLS-1166
Change-Id: I20c824eb5d1d9eabeaaf67ae3945f8da016d985c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoSplit a misleading comment 87/104587/1
Robert Varga [Sun, 26 Feb 2023 14:56:15 +0000 (15:56 +0100)]
Split a misleading comment

We scan files in two steps, but the comment indicates we do that
in one go. Correct that.

Change-Id: I9e3c77006773486ad06cd923edba18652f86f010
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoCollect output file state 80/104180/10
Robert Varga [Thu, 26 Jan 2023 18:36:57 +0000 (19:36 +0100)]
Collect output file state

We need to capture the state of files we are emitting. Plug into
GeneratorTask and generate the file name and has as part of file
writeout.

JIRA: YANGTOOLS-1166
Change-Id: I9e0422e5d1bb7be218ca3dbc9e7611395554a3e1
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoClean up copying warning 83/104583/1
Robert Varga [Fri, 24 Feb 2023 19:46:24 +0000 (20:46 +0100)]
Clean up copying warning

Use try-with-resources to eliminate a warning.

Change-Id: I2cdde13ac39185574d51e925fca52629abdf15e7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoFix a warning 82/104582/1
Robert Varga [Fri, 24 Feb 2023 19:44:09 +0000 (20:44 +0100)]
Fix a warning

Use try-with-resources to manage autocloseable state.

Change-Id: Idd23af7c47e065cf1f45fa496f5f065e50b54693
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
16 months agoMigrate testutils to JUnit5 74/104574/1
Robert Varga [Thu, 23 Feb 2023 19:38:10 +0000 (20:38 +0100)]
Migrate testutils to JUnit5

This is mostly an automated conversion. Also moves tests into the same
package as the tested code.

Change-Id: I70c03c40dfef2aa466aa2c6ca723ccd8a502a9eb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
16 months agoMigrate mockito-configuration to JUnit5 72/104572/1
Robert Varga [Thu, 23 Feb 2023 19:22:33 +0000 (20:22 +0100)]
Migrate mockito-configuration to JUnit5

Automated (and augmented) rewrite of code.

Change-Id: I83c07b2e51a9c006d2e3fb54b11b6d4eb81cf403
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
16 months agoThrow InvalidNormalizedNodeStreamException on bad entry 77/104477/1
Robert Varga [Wed, 22 Feb 2023 14:41:47 +0000 (15:41 +0100)]
Throw InvalidNormalizedNodeStreamException on bad entry

Remove a source of nulls in Lithium-based inputs, allowing us to
properly annotate returns.

Change-Id: Ifc84ce42f9f35ce4c050f87076b0d346b8dbf79d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
16 months agoClean up AbstractMagnesiumDataInput 76/104476/1
Robert Varga [Wed, 22 Feb 2023 14:47:10 +0000 (15:47 +0100)]
Clean up AbstractMagnesiumDataInput

Use switch expression for dispatch and annotate @NonNull returns.

Change-Id: I263cd4be713a58b528576c8df4f3520585e16951
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
16 months agoIntegrate rfc7952-data-api into yang-data-api 47/104447/2
Robert Varga [Sun, 19 Feb 2023 10:54:47 +0000 (11:54 +0100)]
Integrate rfc7952-data-api into yang-data-api

Having a separate component is not really useful and we do want to
provide a unified model for data/metadata and mountpoints. This takes
the first step of integrating the API-level interfaces.

JIRA: YANGTOOLS-1489
Change-Id: I49952adf3ae2a26f09ac3a34e8406ca96d8c23f1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
16 months agoRemove deprecated DataSchemaContextNode elements 61/104461/3
Robert Varga [Tue, 21 Feb 2023 15:42:17 +0000 (16:42 +0100)]
Remove deprecated DataSchemaContextNode elements

The protected constructor, theoretically allowing this class to be
extended has been deprecated for a few releases, as are two static
factory methods. Remove them to allow us to further consider the
hierarchy of this class.

JIRA: YANGTOOLS-1413
Change-Id: I5010aa90ed426bac65d3023e2c64e9e356991e3d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>