use of org.opendaylight.yangtools.yang.model.api.ModuleImport in project controller by opendaylight.
the class ModuleMXBeanEntryBuilder method findSIE.
private static ServiceInterfaceEntry findSIE(final String prefixAndIdentityLocalName, final Module currentModule, final Map<QName, ServiceInterfaceEntry> qNamesToSIEs, final SchemaContext schemaContext) {
Matcher m = PREFIX_COLON_LOCAL_NAME.matcher(prefixAndIdentityLocalName);
Module foundModule;
String localSIName;
if (m.matches()) {
// if there is a prefix, look for ModuleImport with this prefix. Get
// Module from SchemaContext
String prefix = m.group(1);
ModuleImport moduleImport = findModuleImport(currentModule, prefix);
foundModule = schemaContext.findModule(moduleImport.getModuleName(), moduleImport.getRevision()).orElse(null);
checkNotNull(foundModule, format("Module not found in SchemaContext by %s", moduleImport));
localSIName = m.group(2);
} else {
// no prefix => SIE is in currentModule
foundModule = currentModule;
localSIName = prefixAndIdentityLocalName;
}
QName siQName = QName.create(foundModule.getNamespace(), foundModule.getRevision(), localSIName);
ServiceInterfaceEntry sie = qNamesToSIEs.get(siQName);
checkState(sie != null, "Cannot find referenced Service Interface by " + prefixAndIdentityLocalName);
return sie;
}
Aggregations