moduleLoader.loadModule(modid);
} catch (ModuleLoadException ex) {
continue;
}
DefaultResourceBuilder builder = new DefaultResourceBuilder();
Capability icap = builder.addIdentityCapability(symbolicName, version);
icap.getAttributes().put(IdentityNamespace.CAPABILITY_TYPE_ATTRIBUTE, IdentityNamespace.TYPE_ABSTRACT);
icap.getAttributes().put(ModuleIdentifier.class.getName(), modid);
Resource resource = cachedResources.addResource(builder.getResource());
result.add(resource.getIdentityCapability());
}
}
// Add the main module
if (result.isEmpty()) {
ModuleIdentifier modid = ModuleIdentifier.fromString(symbolicName);
try {
moduleLoader.loadModule(modid);
DefaultResourceBuilder builder = new DefaultResourceBuilder();
Capability icap = builder.addIdentityCapability(symbolicName, Version.emptyVersion);
icap.getAttributes().put(IdentityNamespace.CAPABILITY_TYPE_ATTRIBUTE, IdentityNamespace.TYPE_ABSTRACT);
icap.getAttributes().put(ModuleIdentifier.class.getName(), modid);
Resource resource = cachedResources.addResource(builder.getResource());
result.add(resource.getIdentityCapability());
} catch (ModuleLoadException ex) {
// ignore
}