com.partnersoft.scripting
Class ScriptLib

java.lang.Object
  extended by com.partnersoft.scripting.ScriptLib
All Implemented Interfaces:
Lib

public class ScriptLib
extends java.lang.Object
implements Lib


Constructor Summary
ScriptLib()
           
 
Method Summary
static java.lang.Throwable convertToScriptException(java.lang.Throwable oopsie, VfsFile file, int lineNumberAdjustment)
          Converts a random exception to a script exception by parsing the message for things like "line 32".
static Script createScriptFor(Path path)
           
static Script createScriptFor(java.lang.String path)
           
static Script createScriptFor(VfsFile file)
          Creates a script object for the given file.
static javax.script.ScriptException fixScriptException(javax.script.ScriptException oopsie, VfsFile file)
          Fixes the line number in the given ScriptException by parsing the message.
static java.util.List<Script> listScriptsIn(VfsDirectory directory)
          Creates a list of Scripts for all files in the given directory.
static Naming<Script> nameScriptsIn(VfsDirectory directory)
          Creates a Naming of Scripts for all files in the given directory.
static java.lang.String parseFilePath(java.lang.String message)
           
static int parseLineNumber(java.lang.String message)
           
static boolean validate(VfsFile scriptFile)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScriptLib

public ScriptLib()
Method Detail

createScriptFor

public static Script createScriptFor(VfsFile file)
Creates a script object for the given file. Returns null if the file is not a recognizable script.

Parameters:
file -
Returns:

createScriptFor

public static Script createScriptFor(Path path)

createScriptFor

public static Script createScriptFor(java.lang.String path)

listScriptsIn

public static java.util.List<Script> listScriptsIn(VfsDirectory directory)
Creates a list of Scripts for all files in the given directory.


nameScriptsIn

public static Naming<Script> nameScriptsIn(VfsDirectory directory)
Creates a Naming of Scripts for all files in the given directory. Uses the script's basename, without its extension.


fixScriptException

public static javax.script.ScriptException fixScriptException(javax.script.ScriptException oopsie,
                                                              VfsFile file)
Fixes the line number in the given ScriptException by parsing the message.

Parameters:
oopsie -
file -
Returns:

convertToScriptException

public static java.lang.Throwable convertToScriptException(java.lang.Throwable oopsie,
                                                           VfsFile file,
                                                           int lineNumberAdjustment)
Converts a random exception to a script exception by parsing the message for things like "line 32".

Parameters:
oopsie -
file -
Returns:

parseFilePath

public static java.lang.String parseFilePath(java.lang.String message)

parseLineNumber

public static int parseLineNumber(java.lang.String message)

validate

public static boolean validate(VfsFile scriptFile)
                        throws java.io.IOException
Throws:
java.io.IOException