Package com.adobe.xfa

Class ScriptHandler

java.lang.Object
com.adobe.xfa.ScriptHandler
Direct Known Subclasses:
FormCalcScriptHandler, RhinoScriptHandler

public abstract class ScriptHandler extends 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.
  • Field Details

    • UNSPECIFIED

      public static final int UNSPECIFIED
      The unspecified script reason.
      See Also:
    • CALCULATE

      public static final int CALCULATE
      The calculate script reason.
      See Also:
    • VALIDATE

      public static final int VALIDATE
      The validate script reason.
      See Also:
    • ACTIVITY_INITIALIZE

      public static final int ACTIVITY_INITIALIZE
      An activity initialize script reason.
      See Also:
    • ACTIVITY_PRESAVE

      public static final int ACTIVITY_PRESAVE
      An activity pre-save script reason.
      See Also:
    • ACTIVITY_POSTSAVE

      public static final int ACTIVITY_POSTSAVE
      The activity post-save reason.
      See Also:
    • ACTIVITY_PREPRINT

      public static final int ACTIVITY_PREPRINT
      The activity pre-print reason.
      See Also:
    • ACTIVITY_POSTPRINT

      public static final int ACTIVITY_POSTPRINT
      The activity post-print reason.
      See Also:
    • ACTIVITY_READY

      public static final int ACTIVITY_READY
      The activity ready reason.
      See Also:
    • ACTIVITY_DOCREADY

      public static final int ACTIVITY_DOCREADY
      The activity doc ready reason.
      See Also:
    • ACTIVITY_DOCCLOSE

      public static final int ACTIVITY_DOCCLOSE
      The activity do close reason.
      See Also:
    • ACTIVITY_PRESUBMIT

      public static final int ACTIVITY_PRESUBMIT
      The activity pre-submit reason.
      See Also:
    • ACTIVITY_PREEXECUTE

      public static final int ACTIVITY_PREEXECUTE
      The activity pre-execute reason.
      See Also:
    • ACTIVITY_POSTEXECUTE

      public static final int ACTIVITY_POSTEXECUTE
      The activity post-execute reason.
      See Also:
    • ACTIVITY_PREOPEN

      public static final int ACTIVITY_PREOPEN
      The activity pre-open reason.
      See Also:
    • ACTIVITY_INDEXCHANGE

      public static final int ACTIVITY_INDEXCHANGE
      The activity index change reason.
      See Also:
    • PREDICATE

      public static final int PREDICATE
      The predicate (when executing a predicate in a SOM expression) reason.
      See Also:
    • ACTIVITY_PRESIGN

      public static final int ACTIVITY_PRESIGN
      The activity pre-sign reason.
      See Also:
    • ACTIVITY_POSTSIGN

      public static final int ACTIVITY_POSTSIGN
      The activity post-sign reason.
      See Also:
    • ACTIVITY_POSTSUBMIT

      public static final int ACTIVITY_POSTSUBMIT
      The activity post-submit reason.
      See Also:
    • ACTIVITY_POSTOPEN

      public static final int ACTIVITY_POSTOPEN
      The activity post-open reason.
      See Also:
    • ACTIVITY_VALIDATIONSTATE

      public static final int ACTIVITY_VALIDATIONSTATE
      The activity validation state reason.
      See Also:
    • ObjectInteraction_Start

      public static final int ObjectInteraction_Start
      See Also:
    • ACTIVITY_ENTER

      public static final int ACTIVITY_ENTER
      The activity enter reason.
      See Also:
    • ACTIVITY_EXIT

      public static final int ACTIVITY_EXIT
      The activity exit reason.
      See Also:
    • ACTIVITY_MOUSEENTER

      public static final int ACTIVITY_MOUSEENTER
      The activity mouse enter reason.
      See Also:
    • ACTIVITY_MOUSEEXIT

      public static final int ACTIVITY_MOUSEEXIT
      The activity mouse exit reason.
      See Also:
    • ACTIVITY_CHANGE

      public static final int ACTIVITY_CHANGE
      The activity change reason.
      See Also:
    • ACTIVITY_CLICK

      public static final int ACTIVITY_CLICK
      The activity click reason.
      See Also:
    • ACTIVITY_FULL

      public static final int ACTIVITY_FULL
      The activity full reason.
      See Also:
    • ACTIVITY_MOUSEUP

      public static final int ACTIVITY_MOUSEUP
      The activity mouse up reason.
      See Also:
    • ACTIVITY_MOUSEDOWN

      public static final int ACTIVITY_MOUSEDOWN
      The activity mouse down reason.
      See Also:
    • ObjectInteraction_End

      public static final int ObjectInteraction_End
      See Also:
    • executeReason_LAST

      public static final int executeReason_LAST
      See Also:
    • ERR_OK

      public static final int ERR_OK
      See Also:
    • ERR_Syntax

      public static final int ERR_Syntax
      See Also:
    • ERR_BadBreakContinue

      public static final int ERR_BadBreakContinue
      See Also:
    • ERR_FuncBuiltIn

      public static final int ERR_FuncBuiltIn
      See Also:
    • ERR_FuncUnknown

      public static final int ERR_FuncUnknown
      See Also:
    • STEP_OVER

      public static final int STEP_OVER
      See Also:
    • STEP_INTO

      public static final int STEP_INTO
      See Also:
    • STEP_OUT

      public static final int STEP_OUT
      See Also:
    • BREAK

      public static final int BREAK
      See Also:
    • HALT

      public static final int HALT
      See Also:
    • BP_SET

      public static final int BP_SET
      See Also:
    • BP_CLEAR

      public static final int BP_CLEAR
      See Also:
    • FEATURE_NONE

      public static final int FEATURE_NONE
      See Also:
    • FEATURE_IS_REMOTE

      public static final int FEATURE_IS_REMOTE
      See Also:
    • FEATURE_CAN_SET_BREAKPOINT

      public static final int FEATURE_CAN_SET_BREAKPOINT
      See Also:
    • FEATURE_CAN_STEP_OVER

      public static final int FEATURE_CAN_STEP_OVER
      See Also:
    • FEATURE_CAN_STEP_INTO

      public static final int FEATURE_CAN_STEP_INTO
      See Also:
    • FEATURE_CAN_STEP_OUT

      public static final int FEATURE_CAN_STEP_OUT
      See Also:
    • FEATURE_CAN_BREAK

      public static final int FEATURE_CAN_BREAK
      See Also:
    • FEATURE_CAN_HALT

      public static final int FEATURE_CAN_HALT
      See Also:
  • Constructor Details

    • 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 Details

    • createScriptHandler

      public static ScriptHandler createScriptHandler(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(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(String script, 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(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 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(String sOptionName, 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 String getOption(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(String sReason)
      Converts a string into an executeReason.
      Returns:
      the executeReason representing the string (UNSPECIFIED if not recognized).
    • executeReasonToString

      public static 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(List<String> oStack)
      Get the current stack frame.
    • debugGetVariables

      public boolean debugGetVariables(List<String> oVarNames, 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