org.mentawai.core
Class ScriptApplicationManager

java.lang.Object
  extended by org.mentawai.core.ApplicationManager
      extended by org.mentawai.core.ScriptApplicationManager
Direct Known Subclasses:
BshApplicationManager, GroovyApplicationManager

public abstract class ScriptApplicationManager
extends ApplicationManager

An ApplicationManager that runs a script in any language to configure itself. This class is abstract and should be extended to manage script execution from Java. See BshApplicationManager for an example.

Author:
Sergio Oliveira

Field Summary
protected  java.io.File file
           
protected  java.lang.String filename
           
protected  boolean reload
           
 
Fields inherited from class org.mentawai.core.ApplicationManager
ACCESSDENIED, ACTION, ALREADY, APPLICATION, BLOCKED, CREATED, ERROR, EXCEPTION, EXTENSION, INDEX, INPUT, JSP, LIST, LOGIN, MAIN, MENTAWAI_BUILD, MENTAWAI_VERSION, OUTPUT, REDIR, REMOVED, REQUEST, SESSION, SHOW, SUCCESS, TEST, UPDATED
 
Constructor Summary
ScriptApplicationManager()
           
 
Method Summary
protected  java.lang.String getFilename(java.lang.String script)
          The default implementation of this method assumes the script will be in the /APP/WEB-INF/ directory.
protected abstract  java.lang.String getScriptName()
          Returns the file name of the Script that implements the ApplicationManager.
 void runScript(Context application)
          Call this method to execute the configuration script.
abstract  void runScript(java.lang.String scriptFile, Context application)
          Subclasses should override this method to implement the details of how to execute the script from Java.
 void setReloadMode(boolean reload)
          Set reload mode to false if you don't want this class to check if the script was modified and force a reload at runtime.
 
Methods inherited from class org.mentawai.core.ApplicationManager
action, action, action, action, add, add, addActionConfig, addActionPackage, addBeanConfig, addComponent, addDependency, addDependency, addGlobalConsequence, addGlobalFilter, addGlobalFilter, addGlobalFilter, addGlobalFilter, addGlobalFilter, addList, addList, ajax, autoWiring, autoWiring, aw, aw, bean, chain, chain, chain, chain, configureActions, destroy, di, di, filter, filter, filter, filter, filter, filterLast, filterLast, filterLast, fwd, getActionConfig, getActionConfig, getActions, getApplication, getBeanConfig, getComponent, getDefaultAction, getDependencies, getGlobalConsequence, getGlobalFilters, getGlobalFilters, getGlobalFilters, getInstance, getProperties, getRealPath, getReqCharEncoding, getViewDir, init, init, ioc, ioc, ioc, loadActions, loadBeans, loadFormatters, loadLists, loadLocales, on, on, redir, redir, redir, redir, removeActionConfig, removeActionPackage, reset, ruby, ruby, ruby, setAutoView, setConsequenceProvider, setDateMaskForEverything, setDebugMode, setDebugMode, setDefaultAction, setRealPath, setReloadable, setReqCharEncoding, setStatsMode, setViewDir, spring, stream, string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

filename

protected java.lang.String filename

file

protected java.io.File file

reload

protected boolean reload
Constructor Detail

ScriptApplicationManager

public ScriptApplicationManager()
Method Detail

setReloadMode

public void setReloadMode(boolean reload)
Set reload mode to false if you don't want this class to check if the script was modified and force a reload at runtime.

Overrides:
setReloadMode in class ApplicationManager
Parameters:
reload - a flag to indicate if reload mode is on or off

getFilename

protected java.lang.String getFilename(java.lang.String script)
The default implementation of this method assumes the script will be in the /APP/WEB-INF/ directory. You may override this if you want to load the script file from somewhere else.

Parameters:
script - The name of the script to be loaded
Returns:
The complete path to the script file

runScript

public void runScript(Context application)
Call this method to execute the configuration script.

Parameters:
application - The application context for this web application

runScript

public abstract void runScript(java.lang.String scriptFile,
                               Context application)
Subclasses should override this method to implement the details of how to execute the script from Java. The actual script Java interpreter is called here to load and run the script file.

Parameters:
scriptFile - The absolute path to the script file.
application - The application context for this web application.

getScriptName

protected abstract java.lang.String getScriptName()
Returns the file name of the Script that implements the ApplicationManager.

Returns:
the script file name.


Copyright © 2005 Mentawai Team. All Rights Reserved.