Remove BindingRuntimeTypes.findRpc{Input,Output} 60/109360/10
authorRobert Varga <robert.varga@pantheon.tech>
Sat, 16 Dec 2023 20:56:43 +0000 (21:56 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Sun, 17 Dec 2023 09:53:21 +0000 (10:53 +0100)
These methods are no longer used, remove them along with the indexing
support. This indes {Input,Output,Rpc}Generator.

Change-Id: I90820f5e925fd7e72dbe68572e5c671ef277da29
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
binding/mdsal-binding-generator/src/main/java/org/opendaylight/mdsal/binding/generator/impl/BindingRuntimeTypesFactory.java
binding/mdsal-binding-generator/src/main/java/org/opendaylight/mdsal/binding/generator/impl/reactor/InputGenerator.java
binding/mdsal-binding-generator/src/main/java/org/opendaylight/mdsal/binding/generator/impl/reactor/OutputGenerator.java
binding/mdsal-binding-generator/src/main/java/org/opendaylight/mdsal/binding/generator/impl/reactor/RpcGenerator.java
binding/mdsal-binding-generator/src/main/java/org/opendaylight/mdsal/binding/generator/impl/rt/DefaultBindingRuntimeTypes.java
binding/mdsal-binding-runtime-api/src/main/java/org/opendaylight/mdsal/binding/runtime/api/BindingRuntimeTypes.java

index 8a7376042f3dc08a232d1cf9929e9d393fa38faf..9a88b9a0cc9a083327a2a60b6788a2b9e3d21e90 100644 (file)
@@ -19,10 +19,7 @@ import org.opendaylight.mdsal.binding.generator.impl.reactor.AbstractExplicitGen
 import org.opendaylight.mdsal.binding.generator.impl.reactor.Generator;
 import org.opendaylight.mdsal.binding.generator.impl.reactor.GeneratorReactor;
 import org.opendaylight.mdsal.binding.generator.impl.reactor.IdentityGenerator;
-import org.opendaylight.mdsal.binding.generator.impl.reactor.InputGenerator;
 import org.opendaylight.mdsal.binding.generator.impl.reactor.ModuleGenerator;
-import org.opendaylight.mdsal.binding.generator.impl.reactor.OutputGenerator;
-import org.opendaylight.mdsal.binding.generator.impl.reactor.RpcGenerator;
 import org.opendaylight.mdsal.binding.generator.impl.reactor.TypeBuilderFactory;
 import org.opendaylight.mdsal.binding.generator.impl.rt.DefaultBindingRuntimeTypes;
 import org.opendaylight.mdsal.binding.model.api.GeneratedType;
@@ -30,9 +27,7 @@ import org.opendaylight.mdsal.binding.model.api.JavaTypeName;
 import org.opendaylight.mdsal.binding.runtime.api.BindingRuntimeTypes;
 import org.opendaylight.mdsal.binding.runtime.api.CaseRuntimeType;
 import org.opendaylight.mdsal.binding.runtime.api.IdentityRuntimeType;
-import org.opendaylight.mdsal.binding.runtime.api.InputRuntimeType;
 import org.opendaylight.mdsal.binding.runtime.api.ModuleRuntimeType;
-import org.opendaylight.mdsal.binding.runtime.api.OutputRuntimeType;
 import org.opendaylight.mdsal.binding.runtime.api.RuntimeType;
 import org.opendaylight.yangtools.concepts.Mutable;
 import org.opendaylight.yangtools.yang.common.QName;
@@ -50,10 +45,6 @@ final class BindingRuntimeTypesFactory implements Mutable {
     private final Map<QName, IdentityRuntimeType> identities = new HashMap<>();
     // All known types, indexed by their JavaTypeName
     private final Map<JavaTypeName, RuntimeType> allTypes = new HashMap<>();
-    // All RpcOutputs, indexed by their RPC's QName
-    private final Map<QName, OutputRuntimeType> rpcOutputs = new HashMap<>();
-    // All RpcInputs, indexed by their RPC's QName
-    private final Map<QName, InputRuntimeType> rpcInputs = new HashMap<>();
     // All known 'choice's to their corresponding cases
     private final SetMultimap<JavaTypeName, CaseRuntimeType> choiceToCases = HashMultimap.create();
 
@@ -70,7 +61,7 @@ final class BindingRuntimeTypesFactory implements Mutable {
         LOG.debug("Indexed {} generators in {}", moduleGens.size(), sw);
 
         return new DefaultBindingRuntimeTypes(context, factory.modules, factory.allTypes, factory.identities,
-            factory.rpcInputs, factory.rpcOutputs, factory.choiceToCases);
+            factory.choiceToCases);
     }
 
     private void indexModules(final Map<QNameModule, ModuleGenerator> moduleGens) {
@@ -87,17 +78,6 @@ final class BindingRuntimeTypesFactory implements Mutable {
                         safePut(identities, "identities", identity.statement().argument(), identity);
                     });
                 }
-                // FIXME: do not collect these once we they generate a proper RuntimeType
-                if (gen instanceof RpcGenerator rpcGen) {
-                    final QName rpcName = rpcGen.statement().argument();
-                    for (var subgen : gen) {
-                        if (subgen instanceof InputGenerator inputGen) {
-                            inputGen.runtimeType().ifPresent(input -> rpcInputs.put(rpcName, input));
-                        } else if (subgen instanceof OutputGenerator outputGen) {
-                            outputGen.runtimeType().ifPresent(output -> rpcOutputs.put(rpcName, output));
-                        }
-                    }
-                }
             }
         }
 
index 37745e3036da4c737ab518bc841490e8b66f5b9d..99855f4cc1003f59bb69693cabd923565d6a0143 100644 (file)
@@ -23,8 +23,7 @@ import org.opendaylight.yangtools.yang.model.api.stmt.InputEffectiveStatement;
  * as the name. This makes it easier to support multiple RPCs/actions in one source file, as we can import them without
  * a conflict.
  */
-// FIXME: hide this once we have RpcRuntimeType
-public final class InputGenerator extends OperationContainerGenerator<InputEffectiveStatement, InputRuntimeType> {
+final class InputGenerator extends OperationContainerGenerator<InputEffectiveStatement, InputRuntimeType> {
     InputGenerator(final InputEffectiveStatement statement, final AbstractCompositeGenerator<?, ?> parent) {
         super(statement, parent, BindingTypes.RPC_INPUT);
     }
index 39d03628c262bfffcbb235e9f3587026b6f2db5e..fda1d96dd9bd671459592c4a2122f05abf0678d9 100644 (file)
@@ -21,8 +21,7 @@ import org.opendaylight.yangtools.yang.model.api.stmt.OutputEffectiveStatement;
 /**
  * Generator corresponding to an {@code output} statement.
  */
-// FIXME: hide this once we have RpcRuntimeType
-public final class OutputGenerator extends OperationContainerGenerator<OutputEffectiveStatement, OutputRuntimeType> {
+final class OutputGenerator extends OperationContainerGenerator<OutputEffectiveStatement, OutputRuntimeType> {
     OutputGenerator(final OutputEffectiveStatement statement, final AbstractCompositeGenerator<?, ?> parent) {
         super(statement, parent, BindingTypes.RPC_OUTPUT);
     }
index 340ba42115bfbed54a46471ef9ca21d46b2ab514..ed3d5c3e00386d9778b1478d8638acdfcb7eec6c 100644 (file)
@@ -20,8 +20,7 @@ import org.opendaylight.yangtools.yang.model.api.stmt.RpcEffectiveStatement;
 /**
  * Generator corresponding to a {@code rpc} statement.
  */
-// FIXME: hide this once we have RpcRuntimeType
-public final class RpcGenerator extends AbstractInvokableGenerator<RpcEffectiveStatement, RpcRuntimeType> {
+final class RpcGenerator extends AbstractInvokableGenerator<RpcEffectiveStatement, RpcRuntimeType> {
     RpcGenerator(final RpcEffectiveStatement statement, final ModuleGenerator parent) {
         super(statement, parent);
     }
index 13c49461c2f7925caa727a56c654941abedc02e1..a954560bdbf1376b0c69721fef0902b816cf6192 100644 (file)
@@ -25,9 +25,7 @@ import org.opendaylight.mdsal.binding.runtime.api.CaseRuntimeType;
 import org.opendaylight.mdsal.binding.runtime.api.ChoiceRuntimeType;
 import org.opendaylight.mdsal.binding.runtime.api.GeneratedRuntimeType;
 import org.opendaylight.mdsal.binding.runtime.api.IdentityRuntimeType;
-import org.opendaylight.mdsal.binding.runtime.api.InputRuntimeType;
 import org.opendaylight.mdsal.binding.runtime.api.ModuleRuntimeType;
-import org.opendaylight.mdsal.binding.runtime.api.OutputRuntimeType;
 import org.opendaylight.mdsal.binding.runtime.api.RuntimeType;
 import org.opendaylight.mdsal.binding.runtime.api.YangDataRuntimeType;
 import org.opendaylight.yangtools.yang.common.QName;
@@ -44,20 +42,15 @@ public final class DefaultBindingRuntimeTypes implements BindingRuntimeTypes {
     private final ImmutableMap<QNameModule, ModuleRuntimeType> modulesByNamespace;
     private final ImmutableSortedMap<String, ModuleRuntimeType> modulesByPackage;
     private final ImmutableMap<QName, IdentityRuntimeType> identities;
-    private final ImmutableMap<QName, OutputRuntimeType> rpcOutputs;
-    private final ImmutableMap<QName, InputRuntimeType> rpcInputs;
     private final ImmutableMap<JavaTypeName, RuntimeType> types;
 
     public DefaultBindingRuntimeTypes(final EffectiveModelContext context,
             final Map<QNameModule, ModuleRuntimeType> modules, final Map<JavaTypeName, RuntimeType> types,
-            final Map<QName, IdentityRuntimeType> identities, final Map<QName, InputRuntimeType> rpcInputs,
-            final Map<QName, OutputRuntimeType> rpcOutputs,
+            final Map<QName, IdentityRuntimeType> identities,
             final SetMultimap<JavaTypeName, CaseRuntimeType> choiceToCases) {
         this.context = requireNonNull(context);
         this.identities = ImmutableMap.copyOf(identities);
         this.types = ImmutableMap.copyOf(types);
-        this.rpcInputs = ImmutableMap.copyOf(rpcInputs);
-        this.rpcOutputs = ImmutableMap.copyOf(rpcOutputs);
         this.choiceToCases = ImmutableSetMultimap.copyOf(choiceToCases);
 
         modulesByNamespace = ImmutableMap.copyOf(modules);
@@ -93,16 +86,6 @@ public final class DefaultBindingRuntimeTypes implements BindingRuntimeTypes {
         return module == null ? null : module.schemaTreeChild(qname);
     }
 
-    @Override
-    public Optional<InputRuntimeType> findRpcInput(final QName rpcName) {
-        return Optional.ofNullable(rpcInputs.get(requireNonNull(rpcName)));
-    }
-
-    @Override
-    public Optional<OutputRuntimeType> findRpcOutput(final QName rpcName) {
-        return Optional.ofNullable(rpcOutputs.get(requireNonNull(rpcName)));
-    }
-
     @Override
     public Optional<YangDataRuntimeType> findYangData(final YangDataName templateName) {
         final var module = modulesByNamespace.get(templateName.module());
index 6837ef6655dd731b8f6ce0a91a465deea02331f2..8114e0df1b10bf805cad79053a8c943d0cd3696a 100644 (file)
@@ -36,10 +36,6 @@ public interface BindingRuntimeTypes extends EffectiveModelContextProvider, Runt
 
     Optional<RuntimeType> findSchema(JavaTypeName typeName);
 
-    Optional<InputRuntimeType> findRpcInput(QName rpcName);
-
-    Optional<OutputRuntimeType> findRpcOutput(QName rpcName);
-
     Optional<YangDataRuntimeType> findYangData(YangDataName templateName);
 
     default @Nullable RuntimeType schemaTreeChild(final Absolute path) {