Пример #1
0
  /** Returns the module with the given name. */
  public QuercusModule findModule(String name) {
    ModuleInfo moduleInfo = _modules.get(name);
    QuercusModule module = null;

    if (moduleInfo != null) module = moduleInfo.getModule();
    else module = getModuleContext().findModule(name);

    if (module == null)
      throw new IllegalStateException(L.l("'{0}' is an unknown quercus module", name));

    return module;
  }
Пример #2
0
  protected void addModuleInfo(ModuleInfo info) {
    _modules.put(info.getName(), info);

    if (info.getModule() instanceof ModuleStartupListener)
      _moduleStartupListeners.add((ModuleStartupListener) info.getModule());

    for (String ext : info.getLoadedExtensions()) {
      _extensionSet.add(ext);
      _extensionSetLowerCase.add(ext.toLowerCase(Locale.ENGLISH));
    }

    Map<StringValue, Value> map;

    if (isUnicodeSemantics()) map = info.getUnicodeConstMap();
    else map = info.getConstMap();

    if (map != null) {
      for (Map.Entry<StringValue, Value> entry : map.entrySet()) {
        int id = getConstantId(entry.getKey());

        _constantMap[id] = entry.getValue();
      }
    }

    _iniDefinitions.addAll(info.getIniDefinitions());

    for (Map.Entry<String, AbstractFunction> entry : info.getFunctions().entrySet()) {
      String funName = entry.getKey();
      AbstractFunction fun = entry.getValue();

      _funMap.put(funName, fun);
      _lowerFunMap.put(funName.toLowerCase(Locale.ENGLISH), fun);

      setFunction(funName, fun);
    }
  }