use of org.opendaylight.yangtools.concepts.ObjectRegistration 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;
}
Aggregations