- List<ObjectRegistration<YangModuleInfo>> registerInfos(final List<YangModuleInfo> infos) {
- return moduleInfoRegistry.registerModuleInfos(infos);
+ Registration registerBundle(final List<YangModuleInfo> moduleInfos,
+ final List<YangFeatureProvider<?>> featureProviders) {
+ final var infoRegs = resolver.registerModuleInfos(moduleInfos);
+ final var featureRegs = featureProviders.stream()
+ .map(provider -> {
+ @SuppressWarnings("unchecked")
+ final var raw = (YangFeatureProvider<@NonNull DataRoot>) provider;
+ return resolver.registerModuleFeatures(raw.boundModule(), raw.supportedFeatures());
+ })
+ .collect(ImmutableList.toImmutableList());
+
+ return new AbstractRegistration() {
+ @Override
+ protected void removeRegistration() {
+ featureRegs.forEach(Registration::close);
+ infoRegs.forEach(Registration::close);
+ }
+ };