com.caucho.quercus
Class QuercusContext

java.lang.Object
  extended by com.caucho.quercus.QuercusContext
Direct Known Subclasses:
GoogleQuercus, Quercus, ResinQuercus

public class QuercusContext
extends java.lang.Object

Facade for the PHP language.


Field Summary
protected  long _envTimeout
           
protected  IntMap _functionNameMap
           
protected static long ENV_TIMEOUT_UPDATE_INTERVAL
           
static IniDefinition INI_ALWAYS_POPULATE_RAW_POST_DATA
           
static IniDefinition INI_INCLUDE_PATH
           
static IniDefinition INI_REGISTER_LONG_ARRAYS
           
static IniDefinition INI_UNICODE_FALLBACK_ENCODING
           
static IniDefinition INI_UNICODE_FROM_ERROR_MODE
           
static IniDefinition INI_UNICODE_FROM_ERROR_SUBST_CHAR
           
static IniDefinition INI_UNICODE_HTTP_INPUT_ENCODING
           
static IniDefinition INI_UNICODE_OUTPUT_ENCODING
           
static IniDefinition INI_UNICODE_RUNTIME_ENCODING
           
static IniDefinition INI_UNICODE_SCRIPT_ENCODING
           
static IniDefinition INI_UNICODE_SEMANTICS
           
 
Constructor Summary
QuercusContext()
          Constructor.
 
Method Summary
 void addImplClass(java.lang.String name, java.lang.Class<?> type)
          Adds a impl class
 void addInitModule(QuercusModule module)
           
 void addJavaClass(java.lang.String name, java.lang.Class<?> type)
          Adds a java class
 void addJavaClass(java.lang.String phpName, java.lang.String className)
          Adds a java class
 int addLowerConstantId(StringValue name)
          Returns the id for a constant
 void clearDefinitionCache()
          Clears the definition cache.
 void close()
           
 void completeEnv(Env env)
           
 Env createEnv(QuercusPage page, WriteStream out, HttpServletRequest request, HttpServletResponse response)
           
 ExprFactory createExprFactory()
           
protected  ModuleContext createModuleContext(ModuleContext parent, java.lang.ClassLoader loader)
           
protected  PageManager createPageManager()
           
protected  QuercusSessionManager createSessionManager()
           
 StringValue createStaticName()
           
 StringValue createString(java.lang.String name)
          Creates a string.
 UnicodeBuilderValue createUnicodeString(java.lang.String name)
          Creates a string.
 void destroySession(java.lang.String sessionId)
          Removes the session from the backing.
protected  void extendFunctionMap(java.lang.String name, int id)
           
protected  void finalize()
          Calls close().
 ClassDef findClass(java.lang.String name)
          Returns the class with the given name.
 int findClassId(java.lang.String name)
          Returns the id for a function name.
 javax.sql.DataSource findDatabase(java.lang.String driver, java.lang.String url)
          Gets the default data source.
 AbstractFunction findFunction(java.lang.String name)
          Returns the function with the given name.
 int findFunctionId(java.lang.String name)
          Returns the id for a function name.
 AbstractFunction findFunctionImpl(java.lang.String name)
          Returns the function with the given name.
 ClassDef findJavaClassWrapper(java.lang.String name)
          Finds the java class wrapper.
 AbstractFunction findLowerFunctionImpl(java.lang.String lowerName)
          Returns the function with the given name.
 QuercusModule findModule(java.lang.String name)
          Returns the module with the given name.
protected  java.util.Map<Env,Env> getActiveEnvSet()
           
 QuercusClass getCachedClass(int id)
          Returns the undefined functions
 QuercusClass[] getClassCacheMap()
          Returns the undefined functions
 ClassDef getClassDef(int id)
          Returns the class def with the given index.
 ClassDef[] getClassDefMap()
          Returns the undefined functions
 int getClassId(java.lang.String className)
          Returns the id for a class name.
 int getClassIdCount()
          Returns the number of classes
 java.util.HashMap<java.lang.String,ClassDef> getClassMap()
          Returns the class maps.
 java.lang.String getClassName(int id)
           
 java.lang.String getClassName(Path path)
          Returns the relative path.
 java.lang.ClassLoader getCompileClassLoader()
          Returns the compile classloader
 java.sql.Connection getConnection(java.sql.Connection conn)
          Unwrap connection if necessary.
 Value getConstant(int id)
          Returns a named constant.
 int getConstantId(java.lang.String name)
          Returns the id for a constant
 int getConstantId(StringValue name)
          Returns the id for a constant
 int getConstantIdCount()
          Returns the number of defined constants
 int getConstantLower(int id)
          Returns the name map.
 int getConstantLowerId(java.lang.String name)
          Returns the constant id.
 Value[] getConstantMap()
          Returns the name map.
 Value getConstantName(int id)
          Returns the name map.
 java.lang.String getCookieName()
           
 long getCurrentTime()
          Returns the current time.
 javax.sql.DataSource getDatabase()
          Gets the default data source.
 long getDefCacheHitCount()
          Returns the definition cache hit count.
 long getDefCacheMissCount()
          Returns the definition cache miss count.
 ArrayValue getDefinedFunctions()
          Returns an array of the defined functions.
 long getDependencyCheckInterval()
           
 long getExactTime()
          Returns the exact current time in milliseconds.
 long getExactTimeNanoseconds()
          Returns the current time in nanoseconds.
 Value getExtensionFuncs(java.lang.String name)
          Returns true if an extension is loaded.
 int getFunctionId(java.lang.String name)
          Returns the id for a function name.
 int getFunctionIdCount()
          Returns the number of functions
 AbstractFunction[] getFunctionMap()
          Returns the undefined functions
 Path getIncludeCache(StringValue include, java.lang.String includePath, Path pwd, Path scriptPwd)
          Returns an include path.
 int getIncludeCacheMax()
           
 long getIncludeCacheTimeout()
           
 boolean getIniBoolean(java.lang.String name)
          Returns an ini value.
 IniDefinitions getIniDefinitions()
          Returns the IniDefinitions for all ini that have been defined by modules.
 Path getIniFile()
          Returns the ini file.
 long getIniLong(java.lang.String name)
          Returns an ini value as a long.
 java.util.HashMap<java.lang.String,Value> getIniMap(boolean create)
          Returns a map of the ini values that have been explicitly set.
 java.lang.String getIniString(java.lang.String name)
          Returns an ini value.
 Value getIniValue(java.lang.String name)
          Returns an ini value.
 JavaClassDef getJavaClassDefinition(java.lang.Class<?> type, java.lang.String className)
          Adds a java class
 JavaClassDef getJavaClassDefinition(java.lang.String className)
          Adds a java class
 JdbcDriverContext getJdbcDriverContext()
           
 java.util.HashSet<java.lang.String> getLoadedExtensions()
          Returns the loaded extensions.
 ModuleContext getLocalContext()
          Returns the context for this class loader.
 ModuleContext getLocalContext(java.lang.ClassLoader loader)
           
 ModuleContext getModuleContext()
          Returns the module context.
 java.util.Collection<ModuleInfo> getModules()
           
 java.util.HashSet<ModuleStartupListener> getModuleStartupListeners()
          Returns a list of the modules that have some startup code to run.
 java.lang.String getMysqlVersion()
          Returns the mysql version to report to to PHP applications.
 java.lang.String getName()
           
 java.lang.String getOutputEncoding()
          Returns the encoding used for output, null if unicode.semantics is off.
 int getPageCacheSize()
          Gets the max size of the page cache.
 java.lang.String getPhpVersion()
           
 int getProfileIndex(java.lang.String name)
           
 Path getPwd()
          Returns the working directory.
 QuercusSessionManager getQuercusSessionManager()
           
 int getRegexpCacheSize()
          Gets the max size of the regexp cache.
 java.lang.String getSapiName()
          Returns the SAPI (Server API) name.
 java.lang.String getScriptEncoding()
          Returns the expected encoding of php scripts.
 Value getServerEnv(StringValue name)
          Gets a server env value.
 java.util.HashMap<Value,Value> getServerEnvMap()
          Returns the server env map.
 ServletContext getServletContext()
          Returns the ServletContext.
 Cache getSessionCache()
           
 java.lang.Object getSpecial(java.lang.String key)
          Loads a special value
 java.sql.Statement getStatement(java.sql.Statement stmt)
          Unwrap statement if necessary.
 QuercusClass getStdClass()
          Returns the stdClass definition.
 java.lang.String getVersion()
           
 java.lang.String getVersionDate()
           
 Path getWebInfDir()
           
 Path getWorkDir()
           
 boolean includeExists(Path path)
          Returns true if a precompiled page exists
 void init()
          Initialize the engine
protected  void initLocal()
          Initialize local configuration, e.g.
 boolean isAllowUrlFopen()
          Returns true if URLs may be arguments of fopen().
 boolean isAllowUrlInclude()
          Returns true if URLs may be arguments of include().
protected  boolean isClosed()
           
 boolean isCompile()
          true if the pages should be compiled.
 boolean isConnectionPool()
          Returns true if connections should be pooled.
 boolean isExtensionLoaded(java.lang.String name)
          Returns true if an extension is loaded.
 boolean isLooseParse()
          Gets the loose mode.
 boolean isPro()
          Returns true if this is the Professional version.
 boolean isProfile()
           
 boolean isRegisterArgv()
           
 boolean isRequireSource()
          Returns whether the php source is required for compiled files.
 boolean isResin()
          Returns true if Quercus is running under Resin.
 boolean isStrict()
          Gets the strict mode.
static boolean isSuperGlobal(StringValue name)
          Returns true if the variable is a superglobal.
 boolean isUnicodeSemantics()
          Returns true if unicode.semantics is on.
 SessionArrayValue loadSession(Env env, java.lang.String sessionId)
          Loads the session from the backing.
 void markForPoolRemoval(java.sql.Connection conn)
          Marks the connection for removal from the connection pool.
static Value objectToValue(java.lang.Object obj)
           
 QuercusPage parse(Path path)
          Parses a quercus program.
 QuercusPage parse(Path path, java.lang.String fileName, int line)
          Parses a quercus program.
 QuercusPage parse(ReadStream is)
          Parses a quercus program.
 QuercusProgram parseCode(StringValue code)
          Parses a quercus string.
 QuercusProgram parseEvalExpr(StringValue code)
          Parses a quercus string.
 AbstractFunction parseFunction(java.lang.String name, java.lang.String args, java.lang.String code)
          Parses a function.
 void putIncludeCache(StringValue include, java.lang.String includePath, Path pwd, Path scriptPwd, Path path)
          Adds an include path.
 void saveSession(Env env, SessionArrayValue session)
          Saves the session to the backing.
 void setCachedClass(int id, QuercusClass qClass)
          Returns the undefined functions
 void setCompile(boolean isCompile)
          Set true if pages should be compiled.
 void setCompileClassLoader(java.lang.ClassLoader loader)
          Sets the compile classloader
 void setCompileFailover(boolean isCompileFailover)
          true if interpreted pages should be used if pages fail to compile.
 void setConnectionPool(boolean isEnable)
          Turns connection pooling on or off.
 void setDatabase(javax.sql.DataSource database)
          Sets the default data source.
 void setDependencyCheckInterval(long ms)
           
 int setFunction(java.lang.String name, AbstractFunction fun)
           
 void setIncludeCacheMax(int cacheMax)
           
 void setIncludeCacheTimeout(long timeout)
           
 void setIni(java.lang.String name, java.lang.String value)
          Sets an ini value.
 void setIni(java.lang.String name, Value value)
          Sets an ini value.
 void setIniFile(Path path)
          Sets an ini file.
 void setLazyCompile(boolean isCompile)
          Set true if pages should be compiled.
 void setLooseParse(boolean isLoose)
          Sets the loose mode.
 void setMysqlVersion(java.lang.String version)
          Sets the mysql version to report to applications.
 void setPageCacheSize(int size)
          Sets the capacity of the page cache.
 void setPhpVersion(java.lang.String version)
           
 void setProfileProbability(double probability)
           
 void setPwd(Path path)
          Sets the working directory.
 void setRegexpCacheSize(int size)
          Sets the capacity of the regexp cache.
 void setRequireSource(boolean isRequireSource)
          Set to true if compiled pages need to be backed by php source files.
 void setScriptEncoding(java.lang.String encoding)
          Sets the expected encoding of php scripts.
 void setServerEnv(java.lang.String name, java.lang.String value)
          Sets a server env value.
 void setServerEnv(StringValue name, StringValue value)
          Sets a server env value.
 void setServletContext(ServletContext servletContext)
          Sets the ServletContext.
 void setSessionTimeout(long sessionTimeout)
           
 void setSpecial(java.lang.String key, java.lang.Object value)
          Saves a special value
 void setStrict(boolean isStrict)
          Sets the strict mode.
 void setUnicodeSemantics(boolean isUnicode)
           
 void setWebInfDir(Path path)
           
 void setWorkDir(Path workDir)
           
 void start()
           
 void startEnv(Env env)
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_functionNameMap

protected IntMap _functionNameMap

_envTimeout

protected long _envTimeout

ENV_TIMEOUT_UPDATE_INTERVAL

protected static final long ENV_TIMEOUT_UPDATE_INTERVAL
See Also:
Constant Field Values

INI_INCLUDE_PATH

public static final IniDefinition INI_INCLUDE_PATH

INI_REGISTER_LONG_ARRAYS

public static final IniDefinition INI_REGISTER_LONG_ARRAYS

INI_ALWAYS_POPULATE_RAW_POST_DATA

public static final IniDefinition INI_ALWAYS_POPULATE_RAW_POST_DATA

INI_UNICODE_SEMANTICS

public static final IniDefinition INI_UNICODE_SEMANTICS

INI_UNICODE_FALLBACK_ENCODING

public static final IniDefinition INI_UNICODE_FALLBACK_ENCODING

INI_UNICODE_FROM_ERROR_MODE

public static final IniDefinition INI_UNICODE_FROM_ERROR_MODE

INI_UNICODE_FROM_ERROR_SUBST_CHAR

public static final IniDefinition INI_UNICODE_FROM_ERROR_SUBST_CHAR

INI_UNICODE_HTTP_INPUT_ENCODING

public static final IniDefinition INI_UNICODE_HTTP_INPUT_ENCODING

INI_UNICODE_OUTPUT_ENCODING

public static final IniDefinition INI_UNICODE_OUTPUT_ENCODING

INI_UNICODE_RUNTIME_ENCODING

public static final IniDefinition INI_UNICODE_RUNTIME_ENCODING

INI_UNICODE_SCRIPT_ENCODING

public static final IniDefinition INI_UNICODE_SCRIPT_ENCODING
Constructor Detail

QuercusContext

public QuercusContext()
Constructor.

Method Detail

getCurrentTime

public long getCurrentTime()
Returns the current time.


getExactTimeNanoseconds

public long getExactTimeNanoseconds()
Returns the current time in nanoseconds.


getExactTime

public long getExactTime()
Returns the exact current time in milliseconds.


getPwd

public Path getPwd()
Returns the working directory.


setPwd

public void setPwd(Path path)
Sets the working directory.


getWebInfDir

public Path getWebInfDir()

setWebInfDir

public void setWebInfDir(Path path)

getWorkDir

public Path getWorkDir()

setWorkDir

public void setWorkDir(Path workDir)

getCookieName

public java.lang.String getCookieName()

getDependencyCheckInterval

public final long getDependencyCheckInterval()

setDependencyCheckInterval

public final void setDependencyCheckInterval(long ms)

getIncludeCacheMax

public int getIncludeCacheMax()

setIncludeCacheMax

public void setIncludeCacheMax(int cacheMax)

setIncludeCacheTimeout

public void setIncludeCacheTimeout(long timeout)

getIncludeCacheTimeout

public long getIncludeCacheTimeout()

getName

public java.lang.String getName()

getVersion

public java.lang.String getVersion()

getVersionDate

public java.lang.String getVersionDate()

getSapiName

public java.lang.String getSapiName()
Returns the SAPI (Server API) name.


isRegisterArgv

public boolean isRegisterArgv()

isProfile

public boolean isProfile()

getProfileIndex

public int getProfileIndex(java.lang.String name)

setProfileProbability

public void setProfileProbability(double probability)

createPageManager

protected PageManager createPageManager()

createSessionManager

protected QuercusSessionManager createSessionManager()

getLocalContext

public final ModuleContext getLocalContext()
Returns the context for this class loader.


getLocalContext

public ModuleContext getLocalContext(java.lang.ClassLoader loader)

createModuleContext

protected ModuleContext createModuleContext(ModuleContext parent,
                                            java.lang.ClassLoader loader)

getModuleContext

public ModuleContext getModuleContext()
Returns the module context.


getQuercusSessionManager

public QuercusSessionManager getQuercusSessionManager()

isCompile

public boolean isCompile()
true if the pages should be compiled.


isPro

public boolean isPro()
Returns true if this is the Professional version.


isResin

public boolean isResin()
Returns true if Quercus is running under Resin.


setUnicodeSemantics

public void setUnicodeSemantics(boolean isUnicode)

isUnicodeSemantics

public boolean isUnicodeSemantics()
Returns true if unicode.semantics is on.


isAllowUrlInclude

public boolean isAllowUrlInclude()
Returns true if URLs may be arguments of include().


isAllowUrlFopen

public boolean isAllowUrlFopen()
Returns true if URLs may be arguments of fopen().


setCompile

public void setCompile(boolean isCompile)
Set true if pages should be compiled.


setLazyCompile

public void setLazyCompile(boolean isCompile)
Set true if pages should be compiled.


setCompileFailover

public void setCompileFailover(boolean isCompileFailover)
true if interpreted pages should be used if pages fail to compile.


getScriptEncoding

public java.lang.String getScriptEncoding()
Returns the expected encoding of php scripts.


setScriptEncoding

public void setScriptEncoding(java.lang.String encoding)
Sets the expected encoding of php scripts.


getOutputEncoding

public java.lang.String getOutputEncoding()
Returns the encoding used for output, null if unicode.semantics is off.


getMysqlVersion

public java.lang.String getMysqlVersion()
Returns the mysql version to report to to PHP applications. It is user set-able to allow cloaking of the underlying mysql JDBC driver version for application compatibility.


setMysqlVersion

public void setMysqlVersion(java.lang.String version)
Sets the mysql version to report to applications. This cloaks the underlying JDBC driver version, so that when an application asks for the mysql version, this version string is returned instead.


getPhpVersion

public java.lang.String getPhpVersion()

setPhpVersion

public void setPhpVersion(java.lang.String version)

setServletContext

public void setServletContext(ServletContext servletContext)
Sets the ServletContext.


getServletContext

public ServletContext getServletContext()
Returns the ServletContext.


setDatabase

public void setDatabase(javax.sql.DataSource database)
Sets the default data source.


getDatabase

public javax.sql.DataSource getDatabase()
Gets the default data source.


getJdbcDriverContext

public JdbcDriverContext getJdbcDriverContext()

findDatabase

public javax.sql.DataSource findDatabase(java.lang.String driver,
                                         java.lang.String url)
Gets the default data source.


markForPoolRemoval

public void markForPoolRemoval(java.sql.Connection conn)
Marks the connection for removal from the connection pool.


getConnection

public java.sql.Connection getConnection(java.sql.Connection conn)
Unwrap connection if necessary.


getStatement

public java.sql.Statement getStatement(java.sql.Statement stmt)
Unwrap statement if necessary.


setStrict

public void setStrict(boolean isStrict)
Sets the strict mode.


isStrict

public boolean isStrict()
Gets the strict mode.


setLooseParse

public void setLooseParse(boolean isLoose)
Sets the loose mode.


isLooseParse

public boolean isLooseParse()
Gets the loose mode.


getPageCacheSize

public int getPageCacheSize()
Gets the max size of the page cache.


setPageCacheSize

public void setPageCacheSize(int size)
Sets the capacity of the page cache.


getRegexpCacheSize

public int getRegexpCacheSize()
Gets the max size of the regexp cache.


setRegexpCacheSize

public void setRegexpCacheSize(int size)
Sets the capacity of the regexp cache.


setRequireSource

public void setRequireSource(boolean isRequireSource)
Set to true if compiled pages need to be backed by php source files.


isRequireSource

public boolean isRequireSource()
Returns whether the php source is required for compiled files.


setConnectionPool

public void setConnectionPool(boolean isEnable)
Turns connection pooling on or off.


isConnectionPool

public boolean isConnectionPool()
Returns true if connections should be pooled.


addJavaClass

public void addJavaClass(java.lang.String name,
                         java.lang.Class<?> type)
                  throws ConfigException
Adds a java class

Throws:
ConfigException

addJavaClass

public void addJavaClass(java.lang.String phpName,
                         java.lang.String className)
Adds a java class


addImplClass

public void addImplClass(java.lang.String name,
                         java.lang.Class<?> type)
                  throws ConfigException
Adds a impl class

Throws:
ConfigException

getJavaClassDefinition

public JavaClassDef getJavaClassDefinition(java.lang.Class<?> type,
                                           java.lang.String className)
Adds a java class


getJavaClassDefinition

public JavaClassDef getJavaClassDefinition(java.lang.String className)
Adds a java class


findJavaClassWrapper

public ClassDef findJavaClassWrapper(java.lang.String name)
Finds the java class wrapper.


setIniFile

public void setIniFile(Path path)
Sets an ini file.


getIniFile

public Path getIniFile()
Returns the ini file.


getIniDefinitions

public IniDefinitions getIniDefinitions()
Returns the IniDefinitions for all ini that have been defined by modules.


getIniMap

public java.util.HashMap<java.lang.String,Value> getIniMap(boolean create)
Returns a map of the ini values that have been explicitly set.


setIni

public void setIni(java.lang.String name,
                   Value value)
Sets an ini value.


setIni

public void setIni(java.lang.String name,
                   java.lang.String value)
Sets an ini value.


getIniBoolean

public boolean getIniBoolean(java.lang.String name)
Returns an ini value.


getIniLong

public long getIniLong(java.lang.String name)
Returns an ini value as a long.


getIniValue

public Value getIniValue(java.lang.String name)
Returns an ini value.


getIniString

public java.lang.String getIniString(java.lang.String name)
Returns an ini value.


setServerEnv

public void setServerEnv(java.lang.String name,
                         java.lang.String value)
Sets a server env value.


setServerEnv

public void setServerEnv(StringValue name,
                         StringValue value)
Sets a server env value.


getServerEnv

public Value getServerEnv(StringValue name)
Gets a server env value.


getServerEnvMap

public java.util.HashMap<Value,Value> getServerEnvMap()
Returns the server env map.


getCompileClassLoader

public java.lang.ClassLoader getCompileClassLoader()
Returns the compile classloader


setCompileClassLoader

public void setCompileClassLoader(java.lang.ClassLoader loader)
Sets the compile classloader


getClassName

public final java.lang.String getClassName(Path path)
Returns the relative path.


getIncludeCache

public Path getIncludeCache(StringValue include,
                            java.lang.String includePath,
                            Path pwd,
                            Path scriptPwd)
Returns an include path.


putIncludeCache

public void putIncludeCache(StringValue include,
                            java.lang.String includePath,
                            Path pwd,
                            Path scriptPwd,
                            Path path)
Adds an include path.


getDefCacheHitCount

public long getDefCacheHitCount()
Returns the definition cache hit count.


getDefCacheMissCount

public long getDefCacheMissCount()
Returns the definition cache miss count.


clearDefinitionCache

public void clearDefinitionCache()
Clears the definition cache.


includeExists

public boolean includeExists(Path path)
Returns true if a precompiled page exists


parse

public QuercusPage parse(Path path)
                  throws java.io.IOException
Parses a quercus program.

Parameters:
path - the source file path
Returns:
the parsed program
Throws:
java.io.IOException

parse

public QuercusPage parse(Path path,
                         java.lang.String fileName,
                         int line)
                  throws java.io.IOException
Parses a quercus program.

Parameters:
path - the source file path
Returns:
the parsed program
Throws:
java.io.IOException

parse

public QuercusPage parse(ReadStream is)
                  throws java.io.IOException
Parses a quercus program.

Parameters:
path - the source file path
Returns:
the parsed program
Throws:
java.io.IOException

parseCode

public QuercusProgram parseCode(StringValue code)
                         throws java.io.IOException
Parses a quercus string.

Parameters:
code - the source code
Returns:
the parsed program
Throws:
java.io.IOException

parseEvalExpr

public QuercusProgram parseEvalExpr(StringValue code)
                             throws java.io.IOException
Parses a quercus string.

Parameters:
code - the source code
Returns:
the parsed program
Throws:
java.io.IOException

parseFunction

public AbstractFunction parseFunction(java.lang.String name,
                                      java.lang.String args,
                                      java.lang.String code)
                               throws java.io.IOException
Parses a function.

Parameters:
args - the arguments
code - the source code
Returns:
the parsed program
Throws:
java.io.IOException

findFunction

public AbstractFunction findFunction(java.lang.String name)
Returns the function with the given name.


findFunctionImpl

public AbstractFunction findFunctionImpl(java.lang.String name)
Returns the function with the given name.


findLowerFunctionImpl

public AbstractFunction findLowerFunctionImpl(java.lang.String lowerName)
Returns the function with the given name.


getDefinedFunctions

public ArrayValue getDefinedFunctions()
Returns an array of the defined functions.


getFunctionId

public int getFunctionId(java.lang.String name)
Returns the id for a function name.


extendFunctionMap

protected void extendFunctionMap(java.lang.String name,
                                 int id)

findFunctionId

public int findFunctionId(java.lang.String name)
Returns the id for a function name.


getFunctionIdCount

public int getFunctionIdCount()
Returns the number of functions


getFunctionMap

public AbstractFunction[] getFunctionMap()
Returns the undefined functions


setFunction

public int setFunction(java.lang.String name,
                       AbstractFunction fun)

getClassId

public int getClassId(java.lang.String className)
Returns the id for a class name.


getClassName

public java.lang.String getClassName(int id)

findClassId

public int findClassId(java.lang.String name)
Returns the id for a function name.


getClassIdCount

public int getClassIdCount()
Returns the number of classes


getClassDefMap

public ClassDef[] getClassDefMap()
Returns the undefined functions


getClassDef

public ClassDef getClassDef(int id)
Returns the class def with the given index.


getClassCacheMap

public QuercusClass[] getClassCacheMap()
Returns the undefined functions


getCachedClass

public QuercusClass getCachedClass(int id)
Returns the undefined functions


setCachedClass

public void setCachedClass(int id,
                           QuercusClass qClass)
Returns the undefined functions


getConstantId

public int getConstantId(java.lang.String name)
Returns the id for a constant


getConstantId

public int getConstantId(StringValue name)
Returns the id for a constant


addLowerConstantId

public int addLowerConstantId(StringValue name)
Returns the id for a constant


getConstantLower

public int getConstantLower(int id)
Returns the name map.


getConstantLowerId

public int getConstantLowerId(java.lang.String name)
Returns the constant id.


getConstantName

public Value getConstantName(int id)
Returns the name map.


getConstantMap

public Value[] getConstantMap()
Returns the name map.


getConstantIdCount

public int getConstantIdCount()
Returns the number of defined constants


isSuperGlobal

public static boolean isSuperGlobal(StringValue name)
Returns true if the variable is a superglobal.


getStdClass

public QuercusClass getStdClass()
Returns the stdClass definition.


findClass

public ClassDef findClass(java.lang.String name)
Returns the class with the given name.


getClassMap

public java.util.HashMap<java.lang.String,ClassDef> getClassMap()
Returns the class maps.


findModule

public QuercusModule findModule(java.lang.String name)
Returns the module with the given name.


getModuleStartupListeners

public java.util.HashSet<ModuleStartupListener> getModuleStartupListeners()
Returns a list of the modules that have some startup code to run.


isExtensionLoaded

public boolean isExtensionLoaded(java.lang.String name)
Returns true if an extension is loaded.


getLoadedExtensions

public java.util.HashSet<java.lang.String> getLoadedExtensions()
Returns the loaded extensions.


getExtensionFuncs

public Value getExtensionFuncs(java.lang.String name)
Returns true if an extension is loaded.


getModules

public java.util.Collection<ModuleInfo> getModules()

init

public void init()
Initialize the engine


addInitModule

public void addInitModule(QuercusModule module)

createUnicodeString

public UnicodeBuilderValue createUnicodeString(java.lang.String name)
Creates a string. Because these strings are typically Java constants, they fit into a lru cache.


createString

public StringValue createString(java.lang.String name)
Creates a string. Because these strings are typically Java constants, they fit into a lru cache.


getConstant

public Value getConstant(int id)
Returns a named constant.


createStaticName

public StringValue createStaticName()

getSessionCache

public Cache getSessionCache()

setSessionTimeout

public void setSessionTimeout(long sessionTimeout)

loadSession

public SessionArrayValue loadSession(Env env,
                                     java.lang.String sessionId)
Loads the session from the backing.


saveSession

public void saveSession(Env env,
                        SessionArrayValue session)
Saves the session to the backing.


destroySession

public void destroySession(java.lang.String sessionId)
Removes the session from the backing.


getSpecial

public java.lang.Object getSpecial(java.lang.String key)
Loads a special value


setSpecial

public void setSpecial(java.lang.String key,
                       java.lang.Object value)
Saves a special value


objectToValue

public static Value objectToValue(java.lang.Object obj)

initLocal

protected void initLocal()
Initialize local configuration, e.g. finding the PHP and PEAR libraries


start

public void start()

createEnv

public Env createEnv(QuercusPage page,
                     WriteStream out,
                     HttpServletRequest request,
                     HttpServletResponse response)

createExprFactory

public ExprFactory createExprFactory()

getActiveEnvSet

protected java.util.Map<Env,Env> getActiveEnvSet()

startEnv

public void startEnv(Env env)

completeEnv

public void completeEnv(Env env)

isClosed

protected boolean isClosed()

close

public void close()

finalize

protected void finalize()
                 throws java.lang.Throwable
Calls close().

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable