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;
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;
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();
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) {
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));
- }
- }
- }
}
}
* 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);
}
/**
* 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);
}
/**
* 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);
}
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;
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);
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());
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) {