sleep.engine
Class CallRequest

java.lang.Object
  extended by sleep.engine.CallRequest
Direct Known Subclasses:
CallRequest.ClosureCallRequest, CallRequest.FunctionCallRequest, CallRequest.InlineCallRequest

public abstract class CallRequest
extends java.lang.Object

this class encapsulates a function call request. sleep has so many reasons, places, and ways to call functions. this class helps to avoid duplicate code and manage the complexity of Sleep's myriad of profiling, tracing, and error reporting options.


Nested Class Summary
static class CallRequest.ClosureCallRequest
          execute a closure with all of the trimmings.
static class CallRequest.FunctionCallRequest
          execute a function with all of the debug, trace, etc..
static class CallRequest.InlineCallRequest
          execute a block of code inline with all the profiling, tracing, and other support
 
Field Summary
protected  ScriptEnvironment environment
           
protected  int lineNumber
           
 
Constructor Summary
CallRequest(ScriptEnvironment e, int lineNo)
          initialize a new call request
 
Method Summary
 void CallFunction()
          actually execute the function call
protected abstract  Scalar execute()
          execute the function call contained here
protected abstract  java.lang.String formatCall(java.lang.String args)
          return a string view of this function call for trace messages; arguments are captured as comma separated descriptions of all args
abstract  java.lang.String getFrameDescription()
          return the description of this current stack frame in the event of an exception
abstract  java.lang.String getFunctionName()
          return the name of the function (for use in profiler statistics)
 int getLineNumber()
          returns the line number this function call is occuring from
protected  ScriptEnvironment getScriptEnvironment()
          returns the script environment...
 boolean isDebug()
          return true if debug trace is enabled.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

environment

protected ScriptEnvironment environment

lineNumber

protected int lineNumber
Constructor Detail

CallRequest

public CallRequest(ScriptEnvironment e,
                   int lineNo)
initialize a new call request

Method Detail

getScriptEnvironment

protected ScriptEnvironment getScriptEnvironment()
returns the script environment... pHEAR


getLineNumber

public int getLineNumber()
returns the line number this function call is occuring from


getFunctionName

public abstract java.lang.String getFunctionName()
return the name of the function (for use in profiler statistics)


getFrameDescription

public abstract java.lang.String getFrameDescription()
return the description of this current stack frame in the event of an exception


execute

protected abstract Scalar execute()
execute the function call contained here


formatCall

protected abstract java.lang.String formatCall(java.lang.String args)
return a string view of this function call for trace messages; arguments are captured as comma separated descriptions of all args


isDebug

public boolean isDebug()
return true if debug trace is enabled. override this to add/change criteria for trace activiation


CallFunction

public void CallFunction()
actually execute the function call