⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 quercus.java

📁 RESIN 3.2 最新源码
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
    }    def.init();    return def;  }    /**   * Adds a java class   */  public JavaClassDef getJavaClassDefinition(String className)  {    JavaClassDef def;        synchronized (_javaClassWrappers) {      def = _javaClassWrappers.get(className);      if (def == null) {	try {	  def = getModuleContext().getJavaClassDefinition(className);	  _javaClassWrappers.put(className, def);	} catch (RuntimeException e) {	  throw e;	} catch (Exception e) {	  throw new QuercusRuntimeException(e);	}      }    }    def.init();    return def;  }    /**   * Finds the java class wrapper.   */  public ClassDef findJavaClassWrapper(String name)  {    synchronized (_javaClassWrappers) {      ClassDef def = _javaClassWrappers.get(name);      if (def != null)	return def;      return _lowerJavaClassWrappers.get(name.toLowerCase());    }  }  /**   * Sets an ini file.   */  public void setIniFile(Path path)  {    // XXX: Not sure why this dependency would be useful    // Environment.addDependency(new Depend(path));    if (path.canRead()) {      Env env = new Env(this);      Value result = FileModule.parse_ini_file(env, path, false);      if (result instanceof ArrayValue) {        ArrayValue array = (ArrayValue) result;        for (Map.Entry<Value,Value> entry : array.entrySet()) {          setIni(entry.getKey().toString(), entry.getValue().toString());        }      }    }  }  /**   * Returns the IniDefinitions for all ini that have been defined by modules.   */  public IniDefinitions getIniDefinitions()  {    return _iniDefinitions;  }  /**   * Returns a map of the ini values that have been explicitly set.   */  public IdentityHashMap<String, Value> getIniMap(boolean create)  {    if (_iniMap == null && create)      _iniMap = new IdentityHashMap<String, Value>();    return _iniMap;  }  /**   * Sets an ini value.   */  public void setIni(String name, StringValue value)  {    _iniDefinitions.get(name).set(this, value);  }  /**   * Sets an ini value.   */  public void setIni(String name, String value)  {    _iniDefinitions.get(name).set(this, value);  }  /**   * Returns an ini value.   */  public boolean getIniBoolean(String name)  {    return _iniDefinitions.get(name).getAsBoolean(this);  }    /**   * Returns an ini value as a long.   */  public long getIniLong(String name)  {    return _iniDefinitions.get(name).getAsLongValue(this).toLong();  }    /**   * Sets a server env value.   */  public void setServerEnv(String name, String value)  {    setServerEnv(createString(name), createString(value));  }  /**   * Sets a server env value.   */  public void setServerEnv(StringValue name, StringValue value)  {    _serverEnvMap.put(name, value);  }  /**   * Gets a server env value.   */  public Value getServerEnv(StringValue name)  {    return _serverEnvMap.get(name);  }  /**   * Returns the server env map.   */  public HashMap<Value,Value> getServerEnvMap()  {    return _serverEnvMap;  }  /**   * Returns the relative path.   */  /*  public String getClassName(Path path)  {    return _pageManager.getClassName(path);  }  */  /**   * Returns an include path.   */  public Path getIncludeCache(String include,                              String includePath,                              Path pwd,                              Path scriptPwd)  {    IncludeKey key = new IncludeKey(include, includePath, pwd, scriptPwd);    Path path = _includeCache.get(key);    return path;  }  /**   * Adds an include path.   */  public void putIncludeCache(String include,                              String includePath,                              Path pwd,                              Path scriptPwd,                              Path path)  {    IncludeKey key = new IncludeKey(include, includePath, pwd, scriptPwd);    _includeCache.put(key, path);  }  /**   * Returns the definition cache hit count.   */  public long getDefCacheHitCount()  {    return _defCacheHitCount;  }  /**   * Returns the definition cache miss count.   */  public long getDefCacheMissCount()  {    return _defCacheMissCount;  }  /**   * Returns the definition state for an include.   */  /*  public DefinitionState getDefinitionCache(DefinitionKey key)  {    SoftReference<DefinitionState> defStateRef = _defCache.get(key);    if (defStateRef != null) {      DefinitionState defState = defStateRef.get();      if (defState != null) {        _defCacheHitCount++;        return defState.copyLazy();      }    }    _defCacheMissCount++;    return null;  }  */  /**   * Returns the definition state for an include.   */  /*  public void putDefinitionCache(DefinitionKey key,                                 DefinitionState defState)  {    _defCache.put(key, new SoftReference<DefinitionState>(defState.copy()));  }  */  /**   * Clears the definition cache.   */  public void clearDefinitionCache()  {    // _defCache.clear();  }  /**   * Parses a quercus program.   *   * @param path the source file path   * @return the parsed program   * @throws IOException   */  public QuercusPage parse(Path path)    throws IOException  {    return _pageManager.parse(path);  }  /**   * Parses a quercus program.   *   * @param path the source file path   * @return the parsed program   * @throws IOException   */  public QuercusPage parse(Path path, String fileName, int line)    throws IOException  {    return _pageManager.parse(path, fileName, line);  }  /**   * Parses a quercus program.   *   * @param path the source file path   * @return the parsed program   * @throws IOException   */  public QuercusPage parse(ReadStream is)    throws IOException  {    return new InterpretedPage(QuercusParser.parse(this, is));  }  /**   * Parses a quercus string.   *   * @param code the source code   * @return the parsed program   * @throws IOException   */  public QuercusProgram parseCode(String code)    throws IOException  {    QuercusProgram program = _evalCache.get(code);    if (program == null) {      program = QuercusParser.parseEval(this, code);      _evalCache.put(code, program);    }    return program;  }  /**   * Parses a quercus string.   *   * @param code the source code   * @return the parsed program   * @throws IOException   */  public QuercusProgram parseEvalExpr(String code)    throws IOException  {    // XXX: possible conflict with parse eval because of the    // return value changes    QuercusProgram program = _evalCache.get(code);    if (program == null) {      program = QuercusParser.parseEvalExpr(this, code);      _evalCache.put(code, program);    }    return program;  }  /**   * Parses a function.   *   * @param args the arguments   * @param code the source code   * @return the parsed program   * @throws IOException   */  public AbstractFunction parseFunction(String name, String args, String code)    throws IOException  {    return QuercusParser.parseFunction(this, name, args, code);  }  /**   * Returns the function with the given name.   */  public AbstractFunction findFunction(String name)  {    AbstractFunction fun = _funMap.get(name);    if ((fun == null) && ! isStrict())      fun = _lowerFunMap.get(name.toLowerCase());    return fun;  }  /**   * Returns the function with the given name.   */  public AbstractFunction findFunctionImpl(String name)  {    AbstractFunction fun = _funMap.get(name);    return fun;  }  /**   * Returns the function with the given name.   */  public AbstractFunction findLowerFunctionImpl(String lowerName)  {    AbstractFunction fun = _lowerFunMap.get(lowerName);    return fun;  }  /**   * Returns an array of the defined functions.   */  public ArrayValue getDefinedFunctions()  {    ArrayValue internal = new ArrayValueImpl();    for (String name : _funMap.keySet()) {      internal.put(name);    }    return internal;  }  //  // name to id mappings  //  /**   * Returns the id for a function name.   */  public int getFunctionId(String name)  {    if (! isStrict())      name = name.toLowerCase();    synchronized (_functionNameMap) {      int id = _functionNameMap.get(name);      if (id < 0) {        id = _functionNameMap.size();        _functionNameMap.put(name, id);        if (_functionMap.length <= id) {          AbstractFunction []functionMap = new AbstractFunction[id + 256];          System.arraycopy(_functionMap, 0,			   functionMap, 0, _functionMap.length);          _functionMap = functionMap;        }        _functionMap[id] = new UndefinedFunction(name);      }      return id;    }  }  /**   * Returns the id for a function name.   */  public int findFunctionId(String name)  {    if (! isStrict())      name = name.toLowerCase();    // IntMap is internally synchronized    return _functionNameMap.get(name);  }  /**   * Returns the number of functions   */  public int getFunctionIdCount()  {    return _functionNameMap.size();  }  /**   * Returns the undefined functions   */  public AbstractFunction []getFunctionMap()  {    return _functionMap;  }  /**   * Returns the id for a class name.   */  public int getClassId(String name)  {    name = name.toLowerCase();    synchronized (_classNameMap) {      int id = _classNameMap.get(name);      if (id < 0) {	id = _classNameMap.size();	_classNameMap.put(name, id);	if (_classMap.length <= id) {	  ClassDef []classMap = new ClassDef[id + 256];	  System.arraycopy(_classMap, 0, classMap, 0, _classMap.length);	  _classMap = classMap;	}	// _classMap[id] = new UndefinedClass(name);      }      return id;    }  }  /**   * Returns the id for a function name.   */  public int findClassId(String name)  {    synchronized (_classNameMap) {      return _classNameMap.get(name);    }  }  /**   * Returns the number of classes   */  public int getClassIdCount()  {    return _classNameMap.size();  }  /**   * Returns the undefined functions   */  public ClassDef []getClassDefMap()  {    return _classMap;  }  /**   * Returns the id for a constant   */  public int getConstantId(String name)  {    name = name.toLowerCase();    synchronized (_constantNameMap) {      int id = _constantNameMap.get(name);      if (id < 0) {	id = _constantNameMap.size();	_constantNameMap.put(name, id);      }      return id;    }  }  /**   * Returns the number of defined constants   */  public int getConstantIdSize()  {    return _constantNameMap.size();  }  /**   * Returns true if the variable is a superglobal.   */  public static boolean isSuperGlobal(String name)  {    return _superGlobals.contains(name);  }  /**   * Returns the stdClass definition.   */  public QuercusClass getStdClass()  {    return _moduleContext.getStdClass();  }  /**   * Returns the class with the given name.   */  public ClassDef findClass(String name)  {    return _moduleContext.findClass(name);    /*    ClassDef def = _staticClasses.get(name);    if (def == null)      def = _lowerStaticClasses.get(name.toLowerCase());    return def;    */  }  /**   * Returns the class maps.   */  public HashMap<String, ClassDef> getClassMap()  {    /*    return _staticClasses;    */    return _moduleContext.getClassMap();  }  /**   * Returns the module with the given name.   */  public QuercusModule findModule(String name)  {    ModuleInfo moduleInfo =  _modules.get(name);    return moduleInfo == null ? null : moduleInfo.getModule();  }  /**   * Returns a list of the modules that have some startup code to run.   */  public HashSet<ModuleStartupListener> getModuleStartupListeners()  {    return _moduleStartupListeners;  }  /**   * Returns true if an extension is loaded.   */  public boolean isExtensionLoaded(String name)  {    return _extensionSet.contains(name);  }  /**   * Returns true if an extension is loaded.   */  public HashSet<String> getLoadedExtensions()  {    return _extensionSet;  }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -