Package com.adobe.xfa
Class ScriptHandler
- java.lang.Object
-
- com.adobe.xfa.ScriptHandler
-
- Direct Known Subclasses:
FormCalcScriptHandler
,RhinoScriptHandler
public abstract class ScriptHandler extends java.lang.Object
A base class to handle scripting engines. A script handler is used by an XFA application model to enable scripting support. A script handler provides support for one particular language.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ScriptHandler.ScriptException
-
Field Summary
Fields Modifier and Type Field Description static int
ACTIVITY_CHANGE
The activity change reason.static int
ACTIVITY_CLICK
The activity click reason.static int
ACTIVITY_DOCCLOSE
The activity do close reason.static int
ACTIVITY_DOCREADY
The activity doc ready reason.static int
ACTIVITY_ENTER
The activity enter reason.static int
ACTIVITY_EXIT
The activity exit reason.static int
ACTIVITY_FULL
The activity full reason.static int
ACTIVITY_INDEXCHANGE
The activity index change reason.static int
ACTIVITY_INITIALIZE
An activity initialize script reason.static int
ACTIVITY_MOUSEDOWN
The activity mouse down reason.static int
ACTIVITY_MOUSEENTER
The activity mouse enter reason.static int
ACTIVITY_MOUSEEXIT
The activity mouse exit reason.static int
ACTIVITY_MOUSEUP
The activity mouse up reason.static int
ACTIVITY_POSTEXECUTE
The activity post-execute reason.static int
ACTIVITY_POSTOPEN
The activity post-open reason.static int
ACTIVITY_POSTPRINT
The activity post-print reason.static int
ACTIVITY_POSTSAVE
The activity post-save reason.static int
ACTIVITY_POSTSIGN
The activity post-sign reason.static int
ACTIVITY_POSTSUBMIT
The activity post-submit reason.static int
ACTIVITY_PREEXECUTE
The activity pre-execute reason.static int
ACTIVITY_PREOPEN
The activity pre-open reason.static int
ACTIVITY_PREPRINT
The activity pre-print reason.static int
ACTIVITY_PRESAVE
An activity pre-save script reason.static int
ACTIVITY_PRESIGN
The activity pre-sign reason.static int
ACTIVITY_PRESUBMIT
The activity pre-submit reason.static int
ACTIVITY_READY
The activity ready reason.static int
ACTIVITY_VALIDATIONSTATE
The activity validation state reason.static int
BP_CLEAR
static int
BP_SET
static int
BREAK
static int
CALCULATE
The calculate script reason.static int
ERR_BadBreakContinue
static int
ERR_FuncBuiltIn
static int
ERR_FuncUnknown
static int
ERR_OK
static int
ERR_Syntax
static int
executeReason_LAST
static int
FEATURE_CAN_BREAK
static int
FEATURE_CAN_HALT
static int
FEATURE_CAN_SET_BREAKPOINT
static int
FEATURE_CAN_STEP_INTO
static int
FEATURE_CAN_STEP_OUT
static int
FEATURE_CAN_STEP_OVER
static int
FEATURE_IS_REMOTE
static int
FEATURE_NONE
static int
HALT
static int
ObjectInteraction_End
static int
ObjectInteraction_Start
static int
PREDICATE
The predicate (when executing a predicate in a SOM expression) reason.static int
STEP_INTO
static int
STEP_OUT
static int
STEP_OVER
static int
UNSPECIFIED
The unspecified script reason.static int
VALIDATE
The validate script reason.
-
Constructor Summary
Constructors Constructor Description ScriptHandler()
Instantiates a script handler.ScriptHandler(ScriptDebugger oDebugger)
Instantiates a script handler using the given debugger.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description abstract ScriptHandler
clone()
Clones this script handler.static ScriptHandler
createScriptHandler(java.lang.String contentType, AppModel appModel, ScriptDebugger debugger)
Deprecated.This won't work in client environments.boolean
debugBreakPoint(int nScriptID, int nLine, int eSetType)
Set or clear a break-point.boolean
debugCommand(int eCmd)
Set an internal flag in the script handler indicating that, when control is returned to the script handler, it should perform a step-over, step-into or step-out function (calling the stopped callback on the associated debugger).boolean
debugGetStack(java.util.List<java.lang.String> oStack)
Get the current stack frame.boolean
debugGetVariables(java.util.List<java.lang.String> oVarNames, java.util.List<Arg> oVarValues)
Retrieve parallel lists of variable names and their values (lists have the same size).void
execute(java.lang.String script, java.lang.String locale, Arg returnValue, int eReason)
Executes the given script.abstract void
executeOrSyntaxCheck(java.lang.String script, Arg oReturnValue, int eReason, boolean bSyntaxCheckOnly)
Executes or checks the syntax of the given script.static java.lang.String
executeReasonToString(int eReason)
Converts an executeReason into a string.static int
executeReasonToXFAEnum(int eReason)
Converts an executeReason into an XFAEnum.ScriptDebugger
getDebugger()
Get the debugger for this script handler.java.lang.String
getOption(java.lang.String sOptionName)
Gets the value of the given option.abstract java.lang.String
languageName()
Gets the name of the scripting language supported by this script handler.void
removeReference(Node oNode)
Removes any script references to the node and the descendantsvoid
setDebugger(ScriptDebugger oDebugger)
Set the debugger for this script handler.void
setOption(java.lang.String sOptionName, java.lang.String sOptionValue)
Sets the value of the given option.static int
stringToExecuteReason(java.lang.String sReason)
Converts a string into an executeReason.void
syntaxCheck(java.lang.String script)
Checks the given script for syntax errors.boolean
wasFatalError()
Determines the severity of an error is returned from execute().
-
-
-
Field Detail
-
UNSPECIFIED
public static final int UNSPECIFIED
The unspecified script reason.- See Also:
- Constant Field Values
-
CALCULATE
public static final int CALCULATE
The calculate script reason.- See Also:
- Constant Field Values
-
VALIDATE
public static final int VALIDATE
The validate script reason.- See Also:
- Constant Field Values
-
ACTIVITY_INITIALIZE
public static final int ACTIVITY_INITIALIZE
An activity initialize script reason.- See Also:
- Constant Field Values
-
ACTIVITY_PRESAVE
public static final int ACTIVITY_PRESAVE
An activity pre-save script reason.- See Also:
- Constant Field Values
-
ACTIVITY_POSTSAVE
public static final int ACTIVITY_POSTSAVE
The activity post-save reason.- See Also:
- Constant Field Values
-
ACTIVITY_PREPRINT
public static final int ACTIVITY_PREPRINT
The activity pre-print reason.- See Also:
- Constant Field Values
-
ACTIVITY_POSTPRINT
public static final int ACTIVITY_POSTPRINT
The activity post-print reason.- See Also:
- Constant Field Values
-
ACTIVITY_READY
public static final int ACTIVITY_READY
The activity ready reason.- See Also:
- Constant Field Values
-
ACTIVITY_DOCREADY
public static final int ACTIVITY_DOCREADY
The activity doc ready reason.- See Also:
- Constant Field Values
-
ACTIVITY_DOCCLOSE
public static final int ACTIVITY_DOCCLOSE
The activity do close reason.- See Also:
- Constant Field Values
-
ACTIVITY_PRESUBMIT
public static final int ACTIVITY_PRESUBMIT
The activity pre-submit reason.- See Also:
- Constant Field Values
-
ACTIVITY_PREEXECUTE
public static final int ACTIVITY_PREEXECUTE
The activity pre-execute reason.- See Also:
- Constant Field Values
-
ACTIVITY_POSTEXECUTE
public static final int ACTIVITY_POSTEXECUTE
The activity post-execute reason.- See Also:
- Constant Field Values
-
ACTIVITY_PREOPEN
public static final int ACTIVITY_PREOPEN
The activity pre-open reason.- See Also:
- Constant Field Values
-
ACTIVITY_INDEXCHANGE
public static final int ACTIVITY_INDEXCHANGE
The activity index change reason.- See Also:
- Constant Field Values
-
PREDICATE
public static final int PREDICATE
The predicate (when executing a predicate in a SOM expression) reason.- See Also:
- Constant Field Values
-
ACTIVITY_PRESIGN
public static final int ACTIVITY_PRESIGN
The activity pre-sign reason.- See Also:
- Constant Field Values
-
ACTIVITY_POSTSIGN
public static final int ACTIVITY_POSTSIGN
The activity post-sign reason.- See Also:
- Constant Field Values
-
ACTIVITY_POSTSUBMIT
public static final int ACTIVITY_POSTSUBMIT
The activity post-submit reason.- See Also:
- Constant Field Values
-
ACTIVITY_POSTOPEN
public static final int ACTIVITY_POSTOPEN
The activity post-open reason.- See Also:
- Constant Field Values
-
ACTIVITY_VALIDATIONSTATE
public static final int ACTIVITY_VALIDATIONSTATE
The activity validation state reason.- See Also:
- Constant Field Values
-
ObjectInteraction_Start
public static final int ObjectInteraction_Start
- See Also:
- Constant Field Values
-
ACTIVITY_ENTER
public static final int ACTIVITY_ENTER
The activity enter reason.- See Also:
- Constant Field Values
-
ACTIVITY_EXIT
public static final int ACTIVITY_EXIT
The activity exit reason.- See Also:
- Constant Field Values
-
ACTIVITY_MOUSEENTER
public static final int ACTIVITY_MOUSEENTER
The activity mouse enter reason.- See Also:
- Constant Field Values
-
ACTIVITY_MOUSEEXIT
public static final int ACTIVITY_MOUSEEXIT
The activity mouse exit reason.- See Also:
- Constant Field Values
-
ACTIVITY_CHANGE
public static final int ACTIVITY_CHANGE
The activity change reason.- See Also:
- Constant Field Values
-
ACTIVITY_CLICK
public static final int ACTIVITY_CLICK
The activity click reason.- See Also:
- Constant Field Values
-
ACTIVITY_FULL
public static final int ACTIVITY_FULL
The activity full reason.- See Also:
- Constant Field Values
-
ACTIVITY_MOUSEUP
public static final int ACTIVITY_MOUSEUP
The activity mouse up reason.- See Also:
- Constant Field Values
-
ACTIVITY_MOUSEDOWN
public static final int ACTIVITY_MOUSEDOWN
The activity mouse down reason.- See Also:
- Constant Field Values
-
ObjectInteraction_End
public static final int ObjectInteraction_End
- See Also:
- Constant Field Values
-
executeReason_LAST
public static final int executeReason_LAST
- See Also:
- Constant Field Values
-
ERR_OK
public static final int ERR_OK
- See Also:
- Constant Field Values
-
ERR_Syntax
public static final int ERR_Syntax
- See Also:
- Constant Field Values
-
ERR_BadBreakContinue
public static final int ERR_BadBreakContinue
- See Also:
- Constant Field Values
-
ERR_FuncBuiltIn
public static final int ERR_FuncBuiltIn
- See Also:
- Constant Field Values
-
ERR_FuncUnknown
public static final int ERR_FuncUnknown
- See Also:
- Constant Field Values
-
STEP_OVER
public static final int STEP_OVER
- See Also:
- Constant Field Values
-
STEP_INTO
public static final int STEP_INTO
- See Also:
- Constant Field Values
-
STEP_OUT
public static final int STEP_OUT
- See Also:
- Constant Field Values
-
BREAK
public static final int BREAK
- See Also:
- Constant Field Values
-
HALT
public static final int HALT
- See Also:
- Constant Field Values
-
BP_SET
public static final int BP_SET
- See Also:
- Constant Field Values
-
BP_CLEAR
public static final int BP_CLEAR
- See Also:
- Constant Field Values
-
FEATURE_NONE
public static final int FEATURE_NONE
- See Also:
- Constant Field Values
-
FEATURE_IS_REMOTE
public static final int FEATURE_IS_REMOTE
- See Also:
- Constant Field Values
-
FEATURE_CAN_SET_BREAKPOINT
public static final int FEATURE_CAN_SET_BREAKPOINT
- See Also:
- Constant Field Values
-
FEATURE_CAN_STEP_OVER
public static final int FEATURE_CAN_STEP_OVER
- See Also:
- Constant Field Values
-
FEATURE_CAN_STEP_INTO
public static final int FEATURE_CAN_STEP_INTO
- See Also:
- Constant Field Values
-
FEATURE_CAN_STEP_OUT
public static final int FEATURE_CAN_STEP_OUT
- See Also:
- Constant Field Values
-
FEATURE_CAN_BREAK
public static final int FEATURE_CAN_BREAK
- See Also:
- Constant Field Values
-
FEATURE_CAN_HALT
public static final int FEATURE_CAN_HALT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ScriptHandler
public ScriptHandler()
Instantiates a script handler.
-
ScriptHandler
public ScriptHandler(ScriptDebugger oDebugger)
Instantiates a script handler using the given debugger.- Parameters:
oDebugger
- a script debugger.
-
-
Method Detail
-
createScriptHandler
public static ScriptHandler createScriptHandler(java.lang.String contentType, AppModel appModel, ScriptDebugger debugger)
Deprecated.This won't work in client environments.Create a new ScriptHandler that can handle a given contentType.- Parameters:
contentType
- the contentType of the script.appModel
- the AppModel that contains the context for the script.debugger
- the ScriptDebugger for debugging the script, or null if debugging is not required.- Returns:
- a new ScriptHandler.
- Throws:
ExFull
- if the contentType is not recognized.
-
setDebugger
public void setDebugger(ScriptDebugger oDebugger)
Set the debugger for this script handler. Can also be specified in the constructor.
-
executeOrSyntaxCheck
public abstract void executeOrSyntaxCheck(java.lang.String script, Arg oReturnValue, int eReason, boolean bSyntaxCheckOnly)
Executes or checks the syntax of the given script.- Parameters:
script
- the script to execute.oReturnValue
- the return value of the script.eReason
- the reason for the execution of the script.bSyntaxCheckOnly
- the flag to only check syntax when set.- Throws:
ExFull
- whenever errors are reported.
-
execute
public void execute(java.lang.String script, java.lang.String locale, Arg returnValue, int eReason)
Executes the given script.- Parameters:
script
- the script to execute.locale
- the operating locale.returnValue
- the return value of the script.eReason
- the reason for the execution of the script.- Throws:
ExFull
- whenever errors are reported.
-
syntaxCheck
public void syntaxCheck(java.lang.String script)
Checks the given script for syntax errors. Errors are reported in the form of a scriptException exception (scriptException derives from ExFull).- Parameters:
script
- the script to execute.- Throws:
ScriptHandler.ScriptException
- upon syntax error. ScriptException derives from ExFull.
-
languageName
public abstract java.lang.String languageName()
Gets the name of the scripting language supported by this script handler.- Returns:
- the name of the scripting language.
-
setOption
public void setOption(java.lang.String sOptionName, java.lang.String sOptionValue)
Sets the value of the given option. If the option is unknown, the call is ignored.- Parameters:
sOptionName
- the name of the option to set.sOptionValue
- the value to set.
-
getOption
public java.lang.String getOption(java.lang.String sOptionName)
Gets the value of the given option. If the option is unknown, the empty string is returned.- Parameters:
sOptionName
- the name of the option to get.- Returns:
- the value of the specified option as a string.
-
wasFatalError
public boolean wasFatalError()
Determines the severity of an error is returned from execute().
-
clone
public abstract ScriptHandler clone()
Clones this script handler.- Returns:
- a copy of this script handler.
-
stringToExecuteReason
public static int stringToExecuteReason(java.lang.String sReason)
Converts a string into an executeReason.- Returns:
- the executeReason representing the string (UNSPECIFIED if not recognized).
-
executeReasonToString
public static java.lang.String executeReasonToString(int eReason)
Converts an executeReason into a string.- Returns:
- the string representing the executeReason ("other" if not recognized).
-
executeReasonToXFAEnum
public static int executeReasonToXFAEnum(int eReason)
Converts an executeReason into an XFAEnum.- Returns:
- the XFAEnum corresponding to the executeReason (NULL if not recognized). Note in particular that UNSPECIFIED, CALCULATE, and VALIDATE have no XFAEnum equivalent.
-
getDebugger
public ScriptDebugger getDebugger()
Get the debugger for this script handler.
-
debugCommand
public boolean debugCommand(int eCmd)
Set an internal flag in the script handler indicating that, when control is returned to the script handler, it should perform a step-over, step-into or step-out function (calling the stopped callback on the associated debugger).
-
debugBreakPoint
public boolean debugBreakPoint(int nScriptID, int nLine, int eSetType)
Set or clear a break-point.
-
debugGetStack
public boolean debugGetStack(java.util.List<java.lang.String> oStack)
Get the current stack frame.
-
debugGetVariables
public boolean debugGetVariables(java.util.List<java.lang.String> oVarNames, java.util.List<Arg> oVarValues)
Retrieve parallel lists of variable names and their values (lists have the same size). Note that this will only give meaningful results when stopped at a break-point.
-
removeReference
public void removeReference(Node oNode)
Removes any script references to the node and the descendants
-
-