org.mentawai.core
Class ScriptApplicationManager

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

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

Nested Class Summary
 
Nested classes/interfaces inherited from class org.mentawai.core.ApplicationManager
ApplicationManager.Environment
 
Field Summary
protected  File file
           
protected  String filename
           
protected  boolean reload
           
 
Fields inherited from class org.mentawai.core.ApplicationManager
ACCESSDENIED, ACTION, ADD, AJAX, ALREADY, APPLICATION, BACK, BLOCKED, container, CONTEXT_PATH, CREATED, DEFAULT_ENVIRONMENT, EDIT, ERROR, EXCEPTION, EXTENSION, HTML, INDEX, INPUT, JSON, JSP, LIST, LOGIN, MAIN, MENTAWAI_BUILD, MENTAWAI_VERSION, NEXT, NOT_FOUND, OUTPUT, PORT, REDIR, REMOVED, REQUEST, SESSION, SHOW, STREAM, SUCCESS, TEST, UPDATED, XML
 
Constructor Summary
ScriptApplicationManager()
           
 
Method Summary
protected  String getFilename(String script)
          The default implementation of this method assumes the script will be in the /APP/WEB-INF/ directory.
protected abstract  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(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, addLists, addLists, addLocale, addLocale, addLocales, addLocales, addLocalizedLists, addLocalizedLists, ajax, autowire, autowire, autowire, autoWiring, autoWiring, aw, aw, bean, chain, chain, chain, chain, configureActions, createConnectionHandler, createJPAHandler, createSessionHandler, destroy, di, di, exception, filter, filter, filter, filter, filter, filterLast, filterLast, filterLast, fwd, fwd, getActionConfig, getActionConfig, getActions, getApplication, getBeanConfig, getBeanManager, getComponent, getComponentNames, getComponents, getConnectionHandler, getConsequenceProvider, getContainer, getContextPath, getDefaultAction, getDependencies, getEnvironment, getExtension, getGlobalConsequence, getGlobalFilters, getGlobalFilters, getGlobalFilters, getInstance, getParent, getProperties, getProps, getProps, getRealPath, getReqCharEncoding, getViewDir, init, init, internal, ioc, ioc, ioc, ioc, ioc, ioc, ioc, ioc, ioc, ioc, ioc, ioc, loadActions, loadBeans, loadFilters, loadFormatters, loadLists, loadLocales, on, on, onStarted, redir, redir, redir, redir, redir, redir, redir, redir, redir, redir, removeActionConfig, removeActionPackage, reset, result, ruby, ruby, ruby, setAutoView, setAutowireEverything, setConnectionHandler, setConsequenceProvider, setDateMaskForEverything, setDebugMode, setDebugMode, setDefaultAction, setEnvironment, setJPAHandler, setRealPath, setReloadable, setRemoveActionFromName, setReqCharEncoding, setSessionHandler, setStatsMode, setupDB, setupIoC, setViewDir, setWebappPath, spring, spring, stream, string, string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

filename

protected String filename

file

protected 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 String getFilename(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(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 String getScriptName()
Returns the file name of the Script that implements the ApplicationManager.

Returns:
the script file name.


Copyright © 2013. All Rights Reserved.