/*
(non-Javadoc)

@see org.jboss.shrinkwrap.api.container.EnterpriseContainer#addModule(java.net.URL, java.lang.String)
352944
@Override
    public T addAsModule(final URL resource, final String targetPath) throws IllegalArgumentException {
        Validate.notNull(resource, "Resource must be specified");
        Validate.notNull(targetPath, "Target Path must be specified");

        return addAsModule(resource, new BasicPath(targetPath));
    }
192371
function addProviderToModule(source, modulePath, classifiedName, importPath) {
    return addSymbolToNgModuleMetadata(source, modulePath, 'providers', classifiedName, importPath);
}
861105
protected void setModule(String moduleName, CmsBasicDialog dialog) {

        Window window = CmsVaadinUtils.getWindow(dialog);
        window.setContent(this);
        m_module = OpenCms.getModuleManager().getModule(moduleName).clone();
        CmsResourceInfo resInfo = new CmsResourceInfo(
            m_module.getName(),
            m_module.getNiceName(),
            CmsModuleApp.Icons.RESINFO_ICON);
        displayResourceInfoDirectly(Arrays.asList(resInfo));
        fillFields();
    }
1158795
public void setModule(JSModule module) {
    // An input may only belong to one module.
    checkArgument(module == null || this.module == null || this.module == module);
    this.module = module;
  }
848393
public void addRemoteRepositoryByUrl(String url) throws NaetherException {
        try {
            addRemoteRepository(RepoBuilder.remoteRepositoryFromUrl(url));
        } catch (MalformedURLException e) {
            log.error( "Malformed url: {}", url, e);
            throw new NaetherException(e);
        }
    }
221542
public static void createModulesOverview() {

        Map<String, List<ClassField>> hmModules = HortonMachine.getInstance().moduleName2Fields;
        Map<String, List<ClassField>> jggModules = JGrassGears.getInstance().moduleName2Fields;
        Map<String, Class< ? >> hmModulesClasses = HortonMachine.getInstance().moduleName2Class;
        Map<String, Class< ? >> jggModulesClasses = JGrassGears.getInstance().moduleName2Class;

        Set<String> hmNames = hmModules.keySet();
        String[] hmNamesArray = (String[]) hmNames.toArray(new String[hmNames.size()]);

        Set<String> jggNames = jggModules.keySet();
        String[] jggNamesArray = (String[]) jggNames.toArray(new String[jggNames.size()]);

        Arrays.sort(hmNamesArray);
        Arrays.sort(jggNamesArray);

        StringBuilder sb = new StringBuilder();

        sb.append("#summary An overview of the modules implemented in the HortonMachine\n\n");
        sb.append("<wiki:toc max_depth=\"4\" />\n\n");
        sb.append("= HortonMachine Modules Overview =\n");
        sb.append("== !HortonMachine Modules ==\n");

        String status = "CERTIFIED";
        sb.append("=== Release ready ==\n");
        dumpModules(hmModules, hmModulesClasses, hmNamesArray, sb, status);
        status = "TESTED";
        sb.append("=== Tested but not for upcoming release ==\n");
        dumpModules(hmModules, hmModulesClasses, hmNamesArray, sb, status);
        status = "DRAFT";
        sb.append("=== Module that are not passing the QA rules yet ==\n");
        dumpModules(hmModules, hmModulesClasses, hmNamesArray, sb, status);

        sb.append("\n<BR/><BR/><BR/>\n\n");
        sb.append("== Gears Modules ==\n");
        status = "CERTIFIED";
        sb.append("=== Release ready ==\n");
        dumpModules(jggModules, jggModulesClasses, jggNamesArray, sb, status);
        status = "TESTED";
        sb.append("=== Tested but not for upcoming release ==\n");
        dumpModules(jggModules, jggModulesClasses, jggNamesArray, sb, status);
        status = "DRAFT";
        sb.append("=== Module that are not passing the QA rules yet ==\n");
        dumpModules(jggModules, jggModulesClasses, jggNamesArray, sb, status);

        System.out.println(sb.toString());
    }
201759
public void replaceModule(String importFile) throws Exception {

        OpenCms.getModuleManager().replaceModule(
            m_cms,
            importFile,
            new CmsShellReport(m_cms.getRequestContext().getLocale()));

    }
494075
public Governator addModules(List<Module> modules) {
        if (modules != null) {
            this.modules.addAll(modules);
        }
        return this;
    }
615974
public void importModule() {

        Window window = CmsBasicDialog.prepareWindow(DialogWidth.wide);
        CmsImportTabForm form = new CmsImportTabForm(m_app, this::reload);
        window.setContent(form);
        window.setCaption(CmsVaadinUtils.getMessageText(Messages.GUI_MODULES_IMPORT_TITLE_0));
        A_CmsUI.get().addWindow(window);
        window.center();
    }
584703
@Override
    public ApplicationDescriptor javaModule(String uri) {
        model.createChild("module").createChild("java").text(uri);
        return this;
    }
992054
@Override
    public void setupModule(SetupContext context) {
        FindSerializers serializers = new FindSerializers(jsonContext);
        locator.inject(serializers);
        locator.postConstruct(serializers);
        context.addSerializers(serializers);

        FindDeserializers deserializers = new FindDeserializers(jsonContext);
        locator.inject(deserializers);
        locator.postConstruct(deserializers);
        context.addDeserializers(deserializers);
    }
1271701
@Override
    public void initModule() throws ModuleInitializationException {
        Map<String, String> parameters = getParameters();
        copyPropertiesOverParameters(parameters);
        serverInterface = new ServerWrapper(getServer());
        logger.info("Journaling parameters: " + parameters);
        parseParameters(parameters);

        if (inRecoveryMode) {
            worker =
                    new JournalConsumer(parameters, getRole(), serverInterface);
        } else {
            worker = new JournalCreator(parameters, getRole(), serverInterface);
        }
        logger.info("Journal worker module is: " + worker.toString());
    }
204643
@Override
    public ApplicationDescriptor connectorModule(String uri) {
        model.createChild("module").createChild("connector").text(uri);
        return this;
    }
878081
protected void addModuleArg(String jsFile, String moduleName, List<String> args, StringBuilder moduleArg) {
		int argIdx = 0;
		for (Iterator<String> iterArg = args.iterator(); iterArg.hasNext(); argIdx++) {
			String arg = iterArg.next();
			if (arg.equals(JS_ARG)) {
				iterArg.next();
				arg = iterArg.next();
				argIdx += 2;
			}
			if (arg.equals(MODULE_ARG)) {
				arg = iterArg.next();
				argIdx++;
				Matcher matcher = MODULE_ARG_PATTERN.matcher(arg);
				if (matcher.find()) {
					String dep = matcher.group(1);
					if (dep != null) {
						List<String> moduleDependencies = Arrays.asList(dep.split(MODULE_DEPENDENCIES_SEPARATOR));
						if (moduleDependencies.contains(moduleName)) {
							break;
						}
					}
				} else {
					throw new BundlingProcessException(
							"There were an error in the generation of the module dependencies.");
				}
			}
		}

		args.add(argIdx++, JS_ARG);
		args.add(argIdx++, jsFile);
		args.add(argIdx++, MODULE_ARG);
		args.add(argIdx++, moduleArg.toString());
	}
726660
@Override
    public ApplicationDescriptor webModule(String uri, String contextRoot) {
        Node web = model.createChild("module").createChild("web");
        web.createChild("web-uri").text(uri);
        web.createChild("context-root").text(contextRoot);
        return this;
    }
283205
public T addModule(final String moduleName, final String slot, final byte[] newHash) {
        final ContentItem item = createModuleItem(moduleName, slot, newHash);
        addContentModification(createContentModification(item, ModificationType.ADD, NO_CONTENT));
        return returnThis();
    }
236297
@Override
    public T addAsModule(Asset resource, ArchivePath targetPath) throws IllegalArgumentException {
        Validate.notNull(resource, "Resource must be specified");
        Validate.notNull(targetPath, "Target Path must be specified");

        return add(resource, new BasicPath(getModulePath(), targetPath));
    }