com.caucho.quercus.env
Class Env

java.lang.Object
  extended by com.caucho.quercus.env.Env
Direct Known Subclasses:
ProEnv

public class Env
extends java.lang.Object

Represents the Quercus environment.


Field Summary
 java.util.HashMap<java.lang.String,AbstractFunction> _anonymousFunMap
           
 ClassDef[] _classDef
           
 AbstractFunction[] _fun
           
 QuercusClass[] _qClass
           
protected  Quercus _quercus
           
static int B_COMPILE_ERROR
           
static int B_COMPILE_WARNING
           
static int B_CORE_ERROR
           
static int B_CORE_WARNING
           
static int B_ERROR
           
static int B_LAST
           
static int B_NOTICE
           
static int B_PARSE
           
static int B_RECOVERABLE_ERROR
           
static int B_STRICT
           
static int B_USER_ERROR
           
static int B_USER_NOTICE
           
static int B_USER_WARNING
           
static int B_WARNING
           
static int E_ALL
           
static int E_COMPILE_ERROR
           
static int E_COMPILE_WARNING
           
static int E_CORE_ERROR
           
static int E_CORE_WARNING
           
static int E_DEFAULT
           
static int E_ERROR
           
static int E_NOTICE
           
static int E_PARSE
           
static int E_RECOVERABLE_ERROR
           
static int E_STRICT
           
static int E_USER_ERROR
           
static int E_USER_NOTICE
           
static int E_USER_WARNING
           
static int E_WARNING
           
static Value[] EMPTY_VALUE
           
 
Constructor Summary
Env(Quercus quercus)
           
Env(Quercus quercus, QuercusPage page, WriteStream out, HttpServletRequest request, HttpServletResponse response)
           
 
Method Summary
 void addAutoloadFunction(Callback fun)
           
 void addClass(java.lang.String name, ClassDef def)
          Finds the class with the given name.
 void addClassDef(java.lang.String name, ClassDef cl)
          Adds a class, e.g.
 void addCleanup(EnvCleanup envCleanup)
          add resource to the list of refrences that are cleaned up when finished with this environment.
 Value addConstant(java.lang.String name, Value value, boolean isCaseInsensitive)
          Sets a constant.
 Value addFunction(java.lang.String name, AbstractFunction fun)
           
 Value addFunctionFromPage(java.lang.String name, java.lang.String lowerName, AbstractFunction fun)
          Adds a function from a compiled include
 void addInitializedClass(java.lang.String name)
          Mark this class as being initialized.
 void addRemovePath(Path path)
          Adds an auto-remove path.
 void addShutdown(Callback callback, Value[] args)
          Registers a shutdown function.
 void addWildcardImport(java.lang.String name)
          Adds a Quercus class import.
 Value call(java.lang.String name)
          Evaluates the named function.
 Value call(java.lang.String name, Value a0)
          Evaluates the named function.
 Value call(java.lang.String name, Value[] args)
          Evaluates the named function.
 Value call(java.lang.String name, Value a0, Value a1)
          Evaluates the named function.
 Value call(java.lang.String name, Value a0, Value a1, Value a2)
          Evaluates the named function.
 Value call(java.lang.String name, Value a0, Value a1, Value a2, Value a3)
          Evaluates the named function.
 Value call(java.lang.String name, Value a0, Value a1, Value a2, Value a3, Value a4)
          Evaluates the named function.
 Value callRef(java.lang.String name)
          Evaluates the named function.
 Value callRef(java.lang.String name, Value a0)
          EvalRefuates the named function.
 Value callRef(java.lang.String name, Value[] args)
          Evaluates the named function.
 Value callRef(java.lang.String name, Value a0, Value a1)
          EvalRefuates the named function.
 Value callRef(java.lang.String name, Value a0, Value a1, Value a2)
          EvalRefuates the named function.
 Value callRef(java.lang.String name, Value a0, Value a1, Value a2, Value a3)
          Evaluates the named function.
 Value callRef(java.lang.String name, Value a0, Value a1, Value a2, Value a3, Value a4)
          Evaluates the named function.
 Value cast(java.lang.Class cl, Value value)
          Handles exit/die
 void checkTimeout()
          Checks for the program timeout.
 void close()
          Called when the Env is no longer needed.
static Value comma(Value a0, Value a1)
          Returns the last value.
static Value comma(Value a0, Value a1, Value a2)
          Returns the last value.
static Value comma(Value a0, Value a1, Value a2, Value a3)
          Returns the last value.
static Value comma(Value a0, Value a1, Value a2, Value a3, Value a4)
          Returns the last value.
 Value compileError(java.lang.String msg)
          A parse error
 Value compileWarning(java.lang.String msg)
          A parse warning
 AbstractFunction createAnonymousFunction(java.lang.String args, java.lang.String code)
           
 StringValue createBinaryBuilder()
          Creates a binary builder.
 StringValue createBinaryBuilder(byte[] buffer)
          Creates a binary builder.
 StringValue createBinaryBuilder(byte[] buffer, int offset, int length)
          Creates a binary builder.
 StringValue createBinaryBuilder(int length)
          Creates a binary builder.
 StringValue createBinaryString(TempBuffer head)
          Creates a PHP string from a buffer.
 Callback createCallback(Value value)
          Returns the appropriate callback.
 QuercusRuntimeException createErrorException(Location location, java.lang.String msg)
          A fatal runtime error.
 QuercusRuntimeException createErrorException(java.lang.String msg)
          A fatal runtime error.
 Value createException(java.lang.Throwable e)
          Creates a PHP Exception.
 StringValue createLargeBinaryBuilder()
          Creates a binary builder for large things like files.
 ObjectValue createObject()
          Creates a stdClass object.
 SessionArrayValue createSession(java.lang.String sessionId, boolean create)
          Create the session.
 java.lang.String createStaticName()
          Gets a static variable name.
 StringValue createString(byte[] buffer, int offset, int length)
          Creates a PHP string from a byte buffer.
 StringValue createString(char ch)
          Creates a string from a byte.
 StringValue createString(char[] buffer, int length)
          Creates a PHP string from a byte buffer.
 StringValue createString(char[] buffer, int offset, int length)
          Creates a PHP string from a char buffer.
 StringValue createString(java.lang.String s)
          Creates a PHP string from a java String.
 StringValue createStringBuilder()
           
 StringValue createUnicodeBuilder()
          Creates a unicode builder.
 java.lang.String dbgId()
           
 Value deprecatedArgument(java.lang.String name)
          A warning about an deprecated argument passed to a function.
 void destroySession(java.lang.String sessionId)
          Destroy the session.
 Value die()
          Handles exit/die
 Value die(java.lang.String msg)
          Handles exit/die
 Value error(int code, Location location, java.lang.String msg)
           
 Value error(int code, Location location, java.lang.String loc, java.lang.String msg)
          Writes an error.
 Value error(int code, java.lang.String locString, java.lang.String msg)
           
 Value error(Location location, java.lang.String msg)
          A fatal runtime error.
 Value error(java.lang.String msg)
          A fatal runtime error.
 Value error(java.lang.String loc, java.lang.String msg)
          A fatal runtime error.
 Value error(java.lang.String msg, java.lang.Throwable e)
          A warning with an exception.
 Value error(java.lang.Throwable e)
          A warning with an exception.
 Value evalCode(java.lang.String code)
          Compiles and calluates the given code
 Value exit()
          Handles exit/die
 Value exit(Value msg)
          Handles exit/die
 QuercusClass findAbstractClass(java.lang.String name)
          Finds the class with the given name.
 QuercusClass findClass(java.lang.String name)
          Finds the class with the given name.
 QuercusClass findClass(java.lang.String name, boolean useAutoload, boolean useImport)
          Finds the class with the given name.
 ClassDef findClassDef(java.lang.String name)
           
protected  javax.sql.DataSource findDatabase(java.lang.String driver, java.lang.String url)
           
 AbstractFunction findFunction(java.lang.String name)
          Returns the function with a given name.
 AbstractFunction findFunction(java.lang.String className, java.lang.String methodName)
          Finds the class and method.
 AbstractFunction findMethod(java.lang.String className, java.lang.String methodName)
          Finds the java reflection method for the function with the given name.
static Value first(Value value)
          Returns the first value
static Value first(Value value, Value a1)
          Returns the first value
static Value first(Value value, Value a1, Value a2)
          Returns the first value
static Value first(Value value, Value a1, Value a2, Value a3)
          Returns the first value
static Value first(Value value, Value a1, Value a2, Value a3, Value a4)
          Returns the first value
static Value first(Value value, Value a1, Value a2, Value a3, Value a4, Value a5)
          Returns the first value
 void flush()
          Flushes the output buffer.
 int generateId()
          Generate an object id.
 java.lang.String generateSessionId()
          Returns a new session id.
 java.util.ArrayList<Callback> getAutoloadFunctions()
           
 ByteToChar getByteToChar()
          Returns the ByteToChar converter.
 int getCallDepth()
          Returns the stack depth.
 QuercusClass getCallingClass()
           
 java.lang.String getCallingClassName()
           
 QuercusClass getClass(java.lang.String name)
          Finds the class with the given name.
 Value getConfigVar(java.lang.String name)
          Returns the configuration value of an init var.
 java.sql.Connection getConnection(java.lang.String driver, java.lang.String url, java.lang.String userName, java.lang.String password)
          Returns a connection to the given database.
 int getConnectionStatus()
          Returns the connection status
 Value getConstant(java.lang.String name)
          Returns a constant.
 javax.sql.DataSource getDatabase()
          Returns the configured database.
 javax.sql.DataSource getDataSource(java.lang.String driver, java.lang.String url)
          Returns the configured database.
 Value getDeclaredClasses()
          Returns the declared classes.
 StreamContextResource getDefaultStreamContext()
          Returns the default stream resource.
 java.util.TimeZone getDefaultTimeZone()
           
 ArrayValue getDefinedConstants()
          Returns an array of the defined functions.
 ArrayValue getDefinedFunctions()
           
 StringValue getEmptyString()
           
 java.util.HashMap<java.lang.String,Var> getEnv()
          Returns the current environment.
 int getErrorMask()
          Returns the error mask.
 Callback getExceptionHandler()
          Gets the exception handler
 Value getExtensionFuncs(java.lang.String name)
          Returns true if an extension is loaded.
 AbstractFunction getFunction(java.lang.String name)
           
 AbstractFunction getFunction(Value name)
          Finds the java reflection method for the function with the given name.
 Value[] getFunctionArgs()
          Returns the function args.
 java.lang.String getFunctionLocation()
          Returns the current function.
 java.util.HashMap<java.lang.String,Var> getGlobalEnv()
          Returns the current environment.
 Var getGlobalRaw(java.lang.String name)
          Returns the raw global lookup.
 Var getGlobalRef(java.lang.String name)
          Gets a global value.
 Value getGlobalValue(java.lang.String name)
          Gets a global
 Var getGlobalVar(java.lang.String name)
          Gets a value.
 Var getGlobalVar(java.lang.String name, Value value)
          Gets a variable
 java.lang.Object getGzStream()
           
 java.lang.String getHttpInputEncoding()
          Returns the encoding used for input, i.e.
 ArrayValue getIncludedFiles()
          Returns all the included files.
 StringValue getIni(java.lang.String name)
          Returns an ini value.
 boolean getIniBoolean(java.lang.String name)
          Returns an ini value.
 long getIniBytes(java.lang.String name, long deflt)
          Returns an ini value.
 long getIniLong(java.lang.String name)
          Returns an ini value as a long.
 java.util.IdentityHashMap<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 as a string, null for missing or empty string
 StringValue getInputData()
           
static Env getInstance()
           
 JavaClassDef getJavaClassDefinition(java.lang.Class type)
           
 JavaClassDef getJavaClassDefinition(java.lang.String className)
          Returns an introspected Java class defintion.
 HttpSession getJavaSession()
          Returns the Java Http session.
 java.util.HashSet<java.lang.String> getLoadedExtensions()
          Returns true if an extension is loaded.
 LocaleInfo getLocaleInfo()
          Returns the locale info.
static Value getLocalValue(Value var)
          Gets a local value
static Value getLocalVar(Value var)
          Gets a local
 Location getLocation()
          Returns the current execution location.
 java.util.logging.Logger getLogger()
          Returns the logger used for syslog.
 ModuleContext getModuleContext()
          Returns the owning PHP engine.
 WriteStream getOriginalOut()
          Returns the writer.
 WriteStream getOut()
          Returns the writer.
 OutputBuffer getOutputBuffer()
          Returns the current output buffer.
 java.lang.String getOutputEncoding()
          Returns the encoding used for output, null if unicode.semantics is off.
 Path getPwd()
          Returns the current directory.
 Quercus getQuercus()
          Returns the owning PHP engine.
 Var getRef(java.lang.String name)
          Gets a value.
 HttpServletRequest getRequest()
          Returns the request.
 HttpServletResponse getResponse()
          Returns the response.
 java.lang.String getRuntimeEncoding()
          Returns the encoding used for runtime conversions, e.g.
 EncodingReader getRuntimeEncodingFactory()
          Returns the encoding used for runtime conversions, e.g.
 java.lang.String getScriptEncoding()
          Returns the encoding used for scripts.
 Path getSelfDirectory()
          Returns the initial directory.
 Path getSelfPath()
          Returns the initial directory.
 ServletContext getServletContext()
           
 SessionArrayValue getSession()
          Returns the session.
 SessionCallback getSessionCallback()
          Gets the session callback.
static java.lang.String[] getSourceLine(Path path, int sourceLine, int length)
          Returns the source of an error line.
 int getSourceLine(java.lang.String className, int javaLine)
           
 Var getSpecialRef(java.lang.String name)
          Gets a value.
 java.lang.Object getSpecialValue(java.lang.String name)
          Gets a special value, a special value is used to store and retrieve module specific values in the env using a unique name.
 java.util.ArrayList<java.lang.String> getStackTrace()
           
 Value getStaticClassFieldValue(java.lang.String className, java.lang.String name)
          Gets a static class field.
 Var getStaticClassFieldVar(java.lang.String className, java.lang.String name)
          Gets a static field from a class.
 Var getStaticVar(java.lang.String name)
          Gets a static variable
 Path getTempDirectory()
           
 Value getThis()
          Returns the 'this' value.
 Path getUploadDirectory()
          Returns the upload directory.
 Value getValue(java.lang.String name)
          Gets a value.
 Var getVar(java.lang.String name)
          Gets a value.
 Var getVar(java.lang.String name, Value value)
          Gets a variable
 Path getWorkDir()
          Returns the current directory.
 Value ifNull(Value condition, Value ifNull, Value ifNotNull)
          Returns ifNull if condition.isNull(), otherwise returns ifNotNull.
 JavaClassDef importJavaClass(java.lang.String className)
          Imports a Java class.
 boolean importPhpClass(java.lang.String name)
          Imports a PHP class.
 Value include(Path scriptPwd, java.lang.String include, boolean isRequire, boolean isOnce)
          Evaluates an included file.
 Value include(java.lang.String include)
          Evaluates an included file.
 Value includeOnce(Path scriptPwd, java.lang.String include, boolean isRequire)
          Evaluates an included file.
 Value includeOnce(java.lang.String include)
          Evaluates an included file.
 Value invalidArgument(java.lang.String name, java.lang.Object value)
          A warning about an invalid argument passed to a function.
 boolean isAllowUrlFopen()
           
 boolean isAllowUrlInclude()
           
 boolean isDefined(java.lang.String name)
          Returns true if the constant is defined.
 boolean isExtensionLoaded(java.lang.String name)
          Returns true if an extension is loaded.
 boolean isGlobalEnv()
           
 boolean isInitializedClass(java.lang.String name)
          Returns true if class has already been initialized.
 boolean isStrict()
          Returns true for strict mode.
 boolean isUnicodeSemantics()
          Returns true if unicode.semantics is on.
 Path lookup(java.lang.String relPath)
          Looks up the path.
 Path lookupInclude(java.lang.String relPath)
          Looks up the path.
 Path lookupPwd(Value relPathV)
          Looks up based on the pwd.
 Value notice(java.lang.String msg)
          A notice.
 Value notice(java.lang.String msg, java.lang.Throwable e)
          A notice with an exception.
static Value nullAsFalse(Value value)
           
 Value parse(java.lang.String msg)
          A parse error
 Expr peekCall(int depth)
          Peeks at the the top call.
 Value peekCallThis(int depth)
          Peeks at the "this" top call.
 Expr popCall()
          Pops the top call.
 void popEnv(java.util.HashMap<java.lang.String,Var> oldEnv)
          Restores the old environment.
 boolean popOutputBuffer()
          Pops the output buffer
 void print(char v)
          Prints a char
 void print(char[] buffer, int offset, int length)
          Prints a character buffer.
 void print(double v)
          Prints a double
 void print(long v)
          Prints a long
 void print(java.lang.Object v)
          Prints an object
 void print(java.lang.String v)
          Prints a string
 void print(Value v)
          Prints a value
 void println()
          Prints a string
 void println<