return buffer.toString();
}
private void addModuleDependencies(Resource resource, Map<Requirement, Resource> mapping, StringBuffer buffer) {
buffer.append(" <dependencies>");
Runtime runtime = RuntimeLocator.getRequiredRuntime();
for (Requirement req : resource.getRequirements(IdentityNamespace.IDENTITY_NAMESPACE)) {
Resource depres = mapping.get(req);
if (depres != null) {
ModuleIdentifier modid = null;
// #1 Check the runtime for a deployed module
ResourceIdentity resid = depres.getIdentity();
Module module = runtime.getModule(resid);
if (module != null) {
ModuleClassLoader modcl = (ModuleClassLoader) module.adapt(ClassLoader.class);
modid = modcl.getModule().getIdentifier();
}
// #2 Check the attached ModuleIdentifier