throw MESSAGES.classLoaderResolutionFailed(unit);
}
} else {
classLoader = module.getClassLoader();
}
final ArchiveDeployment dep = this.newDeployment(unit.getName(), classLoader);
if (root != null) {
try {
List<VirtualFile> virtualFiles = root.getChildrenRecursively(WS_FILE_FILTER);
final Set<UnifiedVirtualFile> uVirtualFiles = new HashSet<UnifiedVirtualFile>();
for (VirtualFile vf : virtualFiles) {
// Adding the roots of the virtual files.
uVirtualFiles.add(new VirtualFileAdaptor(vf));
}
dep.setMetadataFiles(new LinkedList<UnifiedVirtualFile>(uVirtualFiles));
} catch (IOException e) {
ROOT_LOGGER.cannotLoadMetaDataFiles(e, root);
}
}
if (unit.getParent() != null) {
final String parentDeploymentName = unit.getParent().getName();
final Module parentModule = unit.getParent().getAttachment(Attachments.MODULE);
if (parentModule == null) {
throw MESSAGES.classLoaderResolutionFailed(deploymentRoot);
}
final ClassLoader parentClassLoader = parentModule.getClassLoader();
ROOT_LOGGER.creatingUnifiedWebservicesDeploymentModel(unit.getParent());
final ArchiveDeployment parentDep = this.newDeployment(parentDeploymentName, parentClassLoader);
dep.setParent(parentDep);
}
if (root != null) {
dep.setRootFile(new VirtualFileAdaptor(root));