File modulesDir = injectedServerEnvironment.getValue().getModulesDir();
File moduleDir = new File(modulesDir, symbolicName.replace(".", File.separator) + File.separator + version);
if (moduleDir.exists())
throw new IllegalStateException("Module dir already exists: " + moduleDir);
ResourceContent content = resource.adapt(ResourceContent.class);
IllegalStateAssertion.assertNotNull(content, "Cannot obtain content from: " + resource);
// copy resource content
moduleDir.mkdirs();
File resFile = new File(moduleDir, symbolicName + "-" + version + ".jar");
IOUtils.copyStream(content.getContent(), new FileOutputStream(resFile));
ModuleIdentifier modid = ModuleIdentifier.create(symbolicName, version.toString());
// generate module.xml
File xmlFile = new File(moduleDir, "module.xml");