String namespace = ((WSDLDefinition)unresolved).getNamespace();
if (namespace == null) {
return modelClass.cast(unresolved);
}
List<WSDLDefinition> list = map.get(namespace);
WSDLDefinition resolved = aggregate(list);
if (resolved != null && !resolved.isUnresolved()) {
return modelClass.cast(resolved);
}
// No definition found, delegate the resolution to the imports
for (Import import_ : this.contribution.getImports()) {
if (import_ instanceof NamespaceImport) {
NamespaceImport namespaceImport = (NamespaceImport)import_;
if (namespaceImport.getNamespace().equals(namespace)) {
// Delegate the resolution to the namespace import resolver
resolved =
namespaceImport.getModelResolver().resolveModel(WSDLDefinition.class,
(WSDLDefinition)unresolved);
if (!resolved.isUnresolved()) {
return modelClass.cast(resolved);
}
}
} else if (import_ instanceof DefaultImport) {
// Delegate the resolution to the default import resolver
resolved =
import_.getModelResolver().resolveModel(WSDLDefinition.class,
(WSDLDefinition)unresolved);
if (!resolved.isUnresolved()) {
return modelClass.cast(resolved);
}
}
}
return modelClass.cast(unresolved);