org.directwebremoting.create
Class ScriptedCreator

java.lang.Object
  extended by org.directwebremoting.extend.AbstractCreator
      extended by org.directwebremoting.create.ScriptedCreator
All Implemented Interfaces:
Creator

public class ScriptedCreator
extends AbstractCreator
implements Creator

A creator that uses BeanShell to evaluate some script to create an object.

Author:
Joe Walker [joe at getahead dot ltd dot uk], Dennis [devel at muhlesteins dot com]

Field Summary
 
Fields inherited from interface org.directwebremoting.extend.Creator
APPLICATION, PAGE, REQUEST, SCRIPT, SESSION
 
Constructor Summary
ScriptedCreator()
          Set up some defaults
 
Method Summary
 java.lang.Object getInstance()
          Accessor for the/an instance of this Creator.
 java.lang.String getLanguage()
          The language that we are scripting in.
 java.lang.String getScript()
           
 java.lang.String getScriptPath()
           
 java.lang.Class<?> getType()
          Accessor for the java.lang.Class that this Creator allows access to.
 boolean isReloadable()
          Are we caching the script (default: false)
 boolean isUseDynamicClasses()
          Are we using dynamic classes (i.e.
 void setClass(java.lang.String classname)
          What sort of class do we create?
 void setLanguage(java.lang.String language)
           
 void setReloadable(boolean reloadable)
           
 void setScript(java.lang.String scriptSrc)
           
 void setScriptPath(java.lang.String scriptPath)
           
 void setUseDynamicClasses(boolean useDynamicClasses)
          Are we using dynamic classes (i.e.
 
Methods inherited from class org.directwebremoting.extend.AbstractCreator
getJavascript, getScope, isCacheable, isHidden, setCacheable, setHidden, setJavascript, setProperties, setScope, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.directwebremoting.extend.Creator
getJavascript, getScope, isCacheable, isHidden, setProperties
 

Constructor Detail

ScriptedCreator

public ScriptedCreator()
Set up some defaults

Method Detail

getLanguage

public java.lang.String getLanguage()
The language that we are scripting in. Passed to BSF.

Returns:
Returns the language.

setLanguage

public void setLanguage(java.lang.String language)
Parameters:
language - The language to set.

isReloadable

public boolean isReloadable()
Are we caching the script (default: false)

Returns:
Returns the reloadable variable

setReloadable

public void setReloadable(boolean reloadable)
Parameters:
reloadable - Whether or not to reload the script. The default is true. This parameter is only used if scriptPath is used instead of script. When reloadable is true, ScriptedCreator will check to see if the script has been modified before returning the existing created class.

isUseDynamicClasses

public boolean isUseDynamicClasses()
Are we using dynamic classes (i.e. classes generated by BeanShell or similar) in which case we want to reuse class defs.

Returns:
Returns the useDynamicClasses flag state.

setUseDynamicClasses

public void setUseDynamicClasses(boolean useDynamicClasses)
Are we using dynamic classes (i.e. classes generated by BeanShell or similar) in which case we want to reuse class definitions.

Parameters:
useDynamicClasses - The useDynamicClasses flag state.

getScriptPath

public java.lang.String getScriptPath()
Returns:
Returns the path of the script.

setScriptPath

public void setScriptPath(java.lang.String scriptPath)
Parameters:
scriptPath - Context relative path to script.

getScript

public java.lang.String getScript()
                           throws java.lang.InstantiationException
Returns:
Returns the script.
Throws:
java.lang.InstantiationException - If we can't read from the requested script

setScript

public void setScript(java.lang.String scriptSrc)
Parameters:
scriptSrc - The script to set.

setClass

public void setClass(java.lang.String classname)
What sort of class do we create?

Parameters:
classname - The name of the class

getType

public java.lang.Class<?> getType()
Description copied from interface: Creator
Accessor for the java.lang.Class that this Creator allows access to.

Specified by:
getType in interface Creator
Returns:
The type of this allowed class

getInstance

public java.lang.Object getInstance()
                             throws java.lang.InstantiationException
Description copied from interface: Creator
Accessor for the/an instance of this Creator.

Specified by:
getInstance in interface Creator
Returns:
the instance to use
Throws:
java.lang.InstantiationException - If for some reason the object can not be created

Copyright 2008