Convert mdsal-binding-runtime-spi to a JPMS module 43/93643/1
authorRobert Varga <robert.varga@pantheon.tech>
Fri, 6 Nov 2020 22:38:45 +0000 (23:38 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Fri, 6 Nov 2020 22:40:03 +0000 (23:40 +0100)
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 <robert.varga@pantheon.tech>
binding/mdsal-binding-runtime-spi/pom.xml
binding/mdsal-binding-runtime-spi/src/main/java/module-info.java [new file with mode: 0644]
binding/mdsal-binding-runtime-spi/src/main/java/org/opendaylight/mdsal/binding/runtime/spi/ModuleInfoSnapshotResolver.java

index 16a2ea351c8422c7828a5de1bf1b77129a00ffbc..8d0c328335ad2ab5a05305ceb83be75a6f0725b3 100644 (file)
             <scope>test</scope>
         </dependency>
     </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-                <configuration>
-                    <Automatic-Module-Name>org.opendaylight.mdsal.binding.runtime.spi</Automatic-Module-Name>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
 </project>
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 (file)
index 0000000..a9388a6
--- /dev/null
@@ -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;
+}
index afecd8caec637182d97538d76a57c4dd4cf9f628..c353a80749ab5153b1275dbd64331a4ce8c1ec2b 100644 (file)
@@ -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) {