From: Robert Varga Date: Fri, 6 Nov 2020 22:38:45 +0000 (+0100) Subject: Convert mdsal-binding-runtime-spi to a JPMS module X-Git-Tag: v7.0.2~23 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=5dabf846d396eefff16041b5e32ba2351d238cbf;p=mdsal.git Convert mdsal-binding-runtime-spi to a JPMS module This is a bit involved, as we are using the parser and a couple of services. Nevertheless convert the artifact. JIRA: MDSAL-627 Change-Id: I16bbbe77e2500125512ed57fa22c396e2f662ade Signed-off-by: Robert Varga --- diff --git a/binding/mdsal-binding-runtime-spi/pom.xml b/binding/mdsal-binding-runtime-spi/pom.xml index 16a2ea351c..8d0c328335 100644 --- a/binding/mdsal-binding-runtime-spi/pom.xml +++ b/binding/mdsal-binding-runtime-spi/pom.xml @@ -51,16 +51,4 @@ test - - - - - org.apache.felix - maven-bundle-plugin - - org.opendaylight.mdsal.binding.runtime.spi - - - - diff --git a/binding/mdsal-binding-runtime-spi/src/main/java/module-info.java b/binding/mdsal-binding-runtime-spi/src/main/java/module-info.java new file mode 100644 index 0000000000..a9388a6403 --- /dev/null +++ b/binding/mdsal-binding-runtime-spi/src/main/java/module-info.java @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2020 PANTHEON.tech, s.r.o. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +module org.opendaylight.mdsal.binding.runtime.spi { + exports org.opendaylight.mdsal.binding.runtime.spi; + + requires transitive org.opendaylight.yangtools.yang.parser.api; + requires transitive org.opendaylight.mdsal.binding.runtime.api; + requires org.opendaylight.yangtools.concepts; + requires org.opendaylight.yangtools.yang.parser.impl; + requires org.opendaylight.mdsal.binding.spec.util; + requires org.opendaylight.yangtools.util; + requires org.slf4j; + + uses org.opendaylight.yangtools.yang.model.parser.api.YangParserFactory; + uses org.opendaylight.mdsal.binding.runtime.api.BindingRuntimeGenerator; + + // Annotations + requires static transitive org.eclipse.jdt.annotation; + requires static com.github.spotbugs.annotations; + requires static org.checkerframework.checker.qual; +} diff --git a/binding/mdsal-binding-runtime-spi/src/main/java/org/opendaylight/mdsal/binding/runtime/spi/ModuleInfoSnapshotResolver.java b/binding/mdsal-binding-runtime-spi/src/main/java/org/opendaylight/mdsal/binding/runtime/spi/ModuleInfoSnapshotResolver.java index afecd8caec..c353a80749 100644 --- a/binding/mdsal-binding-runtime-spi/src/main/java/org/opendaylight/mdsal/binding/runtime/spi/ModuleInfoSnapshotResolver.java +++ b/binding/mdsal-binding-runtime-spi/src/main/java/org/opendaylight/mdsal/binding/runtime/spi/ModuleInfoSnapshotResolver.java @@ -36,6 +36,7 @@ import org.opendaylight.mdsal.binding.spec.reflect.BindingReflections; import org.opendaylight.yangtools.concepts.AbstractObjectRegistration; import org.opendaylight.yangtools.concepts.Mutable; import org.opendaylight.yangtools.concepts.ObjectRegistration; +import org.opendaylight.yangtools.concepts.Registration; import org.opendaylight.yangtools.yang.binding.YangModuleInfo; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.common.QNameModule; @@ -50,7 +51,6 @@ import org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceException; import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier; import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource; import org.opendaylight.yangtools.yang.parser.repo.YangTextSchemaContextResolver; -import org.opendaylight.yangtools.yang.parser.repo.YangTextSchemaSourceRegistration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -62,14 +62,13 @@ import org.slf4j.LoggerFactory; @Beta public final class ModuleInfoSnapshotResolver implements Mutable { private static final class RegisteredModuleInfo { - final YangTextSchemaSourceRegistration reg; + final Registration reg; final YangModuleInfo info; final ClassLoader loader; private int refcount = 1; - RegisteredModuleInfo(final YangModuleInfo info, final YangTextSchemaSourceRegistration reg, - final ClassLoader loader) { + RegisteredModuleInfo(final YangModuleInfo info, final Registration reg, final ClassLoader loader) { this.info = requireNonNull(info); this.reg = requireNonNull(reg); this.loader = requireNonNull(loader); @@ -145,7 +144,7 @@ public final class ModuleInfoSnapshotResolver implements Mutable { } // Create an explicit registration - final YangTextSchemaSourceRegistration reg; + final Registration reg; try { reg = ctxResolver.registerSource(toYangTextSource(sourceId, info)); } catch (YangSyntaxErrorException | SchemaSourceException | IOException e) {