com.joanju.cg.core
Class ScriptLoader

java.lang.Object
  extended by com.joanju.cg.core.ScriptLoader

public class ScriptLoader
extends java.lang.Object


Constructor Summary
ScriptLoader()
           
 
Method Summary
static java.io.File getScriptDirectory()
          Get the script directory, or null if the joanjuconfig directory is not found.
static java.lang.Object loadIfAvailable(java.lang.String scriptClassName)
          Load an instance of a script class by class name.
static void runScript(java.lang.String scriptFileName)
          Run a script from the scripts directory.
static boolean scriptExists(java.lang.String scriptFileName)
          Check if a script file exists in joanjuconfig/cgscripts/.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScriptLoader

public ScriptLoader()
Method Detail

getScriptDirectory

public static java.io.File getScriptDirectory()
Get the script directory, or null if the joanjuconfig directory is not found.


loadIfAvailable

public static java.lang.Object loadIfAvailable(java.lang.String scriptClassName)
                                        throws java.io.IOException
Load an instance of a script class by class name.

Returns:
null if the script file does not exist.
Throws:
java.io.IOException - If the script fails to load.

runScript

public static void runScript(java.lang.String scriptFileName)
                      throws ResourceException,
                             ScriptException,
                             java.io.IOException
Run a script from the scripts directory. Don't call this unless you've checked that the script exists!

Throws:
ResourceException
ScriptException
java.io.IOException

scriptExists

public static boolean scriptExists(java.lang.String scriptFileName)
Check if a script file exists in joanjuconfig/cgscripts/. If the joanjuconfig directory didn't exist last time, it's only rechecked if 3 seconds have gone by since the last check. (There were too many ways to launch a build run, so just checking once at the beginning of a build run seemed impractical.)



Copyright © 2008 Joanju Software. All Rights Reserved.