use of org.opendaylight.yangtools.yang.binding.YangModuleInfo in project controller by opendaylight.
the class ModuleInfoBundleTracker method addingBundle.
@Override
@SuppressWarnings("IllegalCatch")
public Collection<ObjectRegistration<YangModuleInfo>> addingBundle(final Bundle bundle, final BundleEvent event) {
URL resource = bundle.getEntry(YANG_MODULE_INFO_SERVICE_PATH);
LOG.debug("Got addingBundle({}) with YangModelBindingProvider resource {}", bundle, resource);
if (resource == null) {
return Collections.emptyList();
}
List<ObjectRegistration<YangModuleInfo>> registrations = new LinkedList<>();
try {
for (String moduleInfoName : Resources.readLines(resource, StandardCharsets.UTF_8)) {
LOG.trace("Retrieve ModuleInfo({}, {})", moduleInfoName, bundle);
YangModuleInfo moduleInfo = retrieveModuleInfo(moduleInfoName, bundle);
registrations.add(moduleInfoRegistry.registerModuleInfo(moduleInfo));
}
if (!starting) {
moduleInfoRegistry.updateService();
}
} catch (final IOException e) {
LOG.error("Error while reading {} from bundle {}", resource, bundle, e);
} catch (final RuntimeException e) {
LOG.error("Failed to process {} for bundle {}", resource, bundle, e);
}
LOG.trace("Got following registrations {}", registrations);
return registrations;
}
use of org.opendaylight.yangtools.yang.binding.YangModuleInfo in project controller by opendaylight.
the class AbstractDataChangeListenerTest method setup.
@Before
public final void setup() throws Exception {
final YangModuleInfo moduleInfo = BindingReflections.getModuleInfo(TwoLevelList.class);
final ModuleInfoBackedContext context = ModuleInfoBackedContext.create();
context.registerModuleInfo(moduleInfo);
this.schemaContext = context.tryToCreateSchemaContext().get();
this.dclExecutorService = new TestDCLExecutorService(SpecialExecutors.newBlockingBoundedFastThreadPool(1, 10, "DCL", AbstractDataChangeListenerTest.class));
this.datastore = new InMemoryDOMDataStore("TEST", this.dclExecutorService);
this.datastore.onGlobalContextUpdated(this.schemaContext);
}
Aggregations