import org.opendaylight.yangtools.yang.binding.YangModelBindingProvider;
import org.opendaylight.yangtools.yang.binding.YangModuleInfo;
import org.osgi.framework.Bundle;
import org.opendaylight.yangtools.yang.binding.YangModelBindingProvider;
import org.opendaylight.yangtools.yang.binding.YangModuleInfo;
import org.osgi.framework.Bundle;
*/
public final class ModuleInfoBundleTracker implements BundleTrackerCustomizer<Collection<ObjectRegistration<YangModuleInfo>>> {
private static final Logger logger = LoggerFactory.getLogger(ModuleInfoBundleTracker.class);
*/
public final class ModuleInfoBundleTracker implements BundleTrackerCustomizer<Collection<ObjectRegistration<YangModuleInfo>>> {
private static final Logger logger = LoggerFactory.getLogger(ModuleInfoBundleTracker.class);
- public GeneratedClassLoadingStrategy getModuleInfoLoadingStrategy() {
- return moduleInfoLoadingStrategy;
+ private final ModuleInfoRegistry moduleInfoRegistry;
+
+ public ModuleInfoBundleTracker(ModuleInfoRegistry moduleInfoRegistry) {
+ this.moduleInfoRegistry = moduleInfoRegistry;
}
@Override
public Collection<ObjectRegistration<YangModuleInfo>> addingBundle(Bundle bundle, BundleEvent event) {
URL resource = bundle.getEntry(MODULE_INFO_PROVIDER_PATH_PREFIX + YangModelBindingProvider.class.getName());
}
@Override
public Collection<ObjectRegistration<YangModuleInfo>> addingBundle(Bundle bundle, BundleEvent event) {
URL resource = bundle.getEntry(MODULE_INFO_PROVIDER_PATH_PREFIX + YangModelBindingProvider.class.getName());
List<ObjectRegistration<YangModuleInfo>> registrations = new LinkedList<>();
try (InputStream inputStream = resource.openStream()) {
List<String> lines = IOUtils.readLines(inputStream);
for (String moduleInfoName : lines) {
List<ObjectRegistration<YangModuleInfo>> registrations = new LinkedList<>();
try (InputStream inputStream = resource.openStream()) {
List<String> lines = IOUtils.readLines(inputStream);
for (String moduleInfoName : lines) {
} catch (Exception e) {
logger.error("Error while reading {}", resource, e);
throw new RuntimeException(e);
}
} catch (Exception e) {
logger.error("Error while reading {}", resource, e);
throw new RuntimeException(e);
}
return registrations;
}
@Override
public void modifiedBundle(Bundle bundle, BundleEvent event, Collection<ObjectRegistration<YangModuleInfo>> object) {
return registrations;
}
@Override
public void modifiedBundle(Bundle bundle, BundleEvent event, Collection<ObjectRegistration<YangModuleInfo>> object) {
errorMessage = logMessage("Could not instantiate {} in bundle {}, reason {}", moduleInfoClass, bundle, e);
throw new IllegalStateException(errorMessage, e);
} catch (IllegalAccessException e) {
errorMessage = logMessage("Could not instantiate {} in bundle {}, reason {}", moduleInfoClass, bundle, e);
throw new IllegalStateException(errorMessage, e);
} catch (IllegalAccessException e) {
- errorMessage = logMessage("Illegal access during instatiation of class {} in bundle {}, reason {}",
+ errorMessage = logMessage("Illegal access during instantiation of class {} in bundle {}, reason {}",
moduleInfoClass, bundle, e);
throw new IllegalStateException(errorMessage, e);
}
moduleInfoClass, bundle, e);
throw new IllegalStateException(errorMessage, e);
}
- String errorMessage = logMessage("Could not find class {} in bunde {}, reason {}", moduleInfoClass, bundle, e);
+ String errorMessage = logMessage("Could not find class {} in bundle {}, reason {}", moduleInfoClass, bundle, e);