private boolean addRequires(FacesContext facesContext, JspWriter writer, boolean useMetaScript, String requiredFiles, String requiredClasses) throws IOException {
static boolean addRequires(FacesContext facesContext, JspWriter writer, IHtmlProcessContext htmlProcessContext, String requiredFiles, String requiredClasses) throws IOException {
    private boolean addRequires(FacesContext facesContext, JspWriter writer,            boolean useMetaScript, String requiredFiles, String requiredClasses)            throws IOException {        IJavaScriptRepository repository = JavaScriptRepositoryServlet                .getRepository(facesContext);        if (repository == null) {            LOG.error("JavaScript repository is not created yet !");            return false;        }        List files = new ArrayList();        if (requiredFiles != null) {            StringTokenizer st = new StringTokenizer(requiredFiles, ", ");            for (; st.hasMoreTokens();) {                String requiredFile = st.nextToken();                IRepository.IFile file = repository.getSetByName(requiredFile);                if (file == null) {                    file = repository.getModuleByName(requiredFile);                    if (file == null) {                        file = repository.getFileByName(requiredFile);                    }                }                if (file == null) {                    LOG.error("Can not find required file '" + requiredFile                            + "' !");                    continue;                }                files.add(file);            }        }        if (requiredClasses != null) {            StringTokenizer st = new StringTokenizer(requiredClasses, ", ");            for (; st.hasMoreTokens();) {                String className = st.nextToken();                IJavaScriptRepository.IClass clazz = repository                        .getClassByName(className);                if (clazz == null) {                    LOG.error("Can not find required class '" + className                            + "' !");                    continue;                }                files.add(clazz.getFile());            }        }        if (files.isEmpty()) {            return false;        }        IRepository.IContext repositoryContext;        repositoryContext = JavaScriptRepositoryServlet                .getContextRepository(facesContext);        IFile fs[] = repository.computeFiles(files,                IRepository.FILE_COLLECTION_TYPE, repositoryContext);        if (fs.length < 1) {            return false;        }        writer.print("<SCRIPT");        if (useMetaScript == false) {            writer.write(" type=\"");            writer.write(IHtmlRenderContext.JAVASCRIPT_TYPE);            writer.write('"');        }        writer.write('>');        boolean useScriptCData = htmlRenderContext.useScriptCData();        if (useScriptCData) {            writer.write(IHtmlRenderContext.JAVASCRIPT_CDATA_BEGIN);        }        writer.println();        Map symbols = JavaScriptRepositoryServlet.getSymbols(facesContext);        IJavaScriptWriter jsWriter = new JavaScriptWriterImpl(facesContext,                symbols, writer);        JavaScriptRenderContext.initializeJavaScript(jsWriter, repository,                htmlRenderContext);        jsWriter.writeCall("_classLoader", "requiresBundle");        jsWriter.write("document");        Locale locale = repositoryContext.getLocale();        for (int i = 0; i < fs.length; i++) {            String src = fs[i].getURI(locale);            jsWriter.write(", \"").write(src).write('"');        }        jsWriter.writeln(");");        return true;    }