public class DefaultScriptingScript extends AbstractScript implements ScriptingScript
Modifier and Type | Class and Description |
---|---|
static class |
DefaultScriptingScript.OutputWriter |
Modifier and Type | Field and Description |
---|---|
protected CompiledScript |
compiledCode |
protected ScriptEngine |
engine |
protected String |
extension |
protected String |
langName |
protected String |
librarySuffix |
enabled, isolationGroup
changeListener, createdBy, description, id, manager, name, parent, saved, typename, version
ISOLATION_HIGH, ISOLATION_LOW
Modifier | Constructor and Description |
---|---|
|
DefaultScriptingScript(ScriptingFolder parent,
ScriptingManager manager,
String id) |
protected |
DefaultScriptingScript(ScriptingFolder parent,
String typename,
ScriptingManager manager,
String id) |
Modifier and Type | Method and Description |
---|---|
Object |
__call__() |
Object |
__call__(Object[] args) |
Object |
__getattr__(String name) |
void |
__setattr__(String name,
Object value) |
void |
addDisposable(Disposable disposable) |
void |
addObserver(Observer o) |
void |
addStderrWriter(Writer err) |
void |
addStdoutWriter(Writer out) |
void |
compile() |
protected void |
console_println(String s) |
void |
create(ScriptingFolder folder,
String id,
String language) |
void |
deleteObserver(Observer o) |
void |
deleteObservers() |
ScriptingUnit |
get(File file) |
ScriptingUnit |
get(String name) |
String |
getCode()
Returns the ScriptingScript's code.
|
protected String |
getCodeToInitializeEngine() |
ScriptEngine |
getEngine() |
String |
getExtension() |
List<File> |
getFiles()
Return a list of the files that use this unit with out the inf file.
|
String[] |
getIconNames()
Gets the name of the icons associated to the ScriptingUnit type.
|
String |
getLangName()
Returns the languange in which the ScriptingScript is written.
|
List<File> |
getLibFolders() |
String |
getLibrarySuffix() |
String |
getMainName()
Returns the name of the main function in the ScriptingScript's code
|
String |
getMimeType() |
String |
getNewTemplate() |
File |
getResource(String filename)
Return a resource File that is beside this script.
|
File |
getScriptFile() |
DefaultScriptingScript.OutputWriter |
getStderr() |
DefaultScriptingScript.OutputWriter |
getStdout() |
Object |
invokeFunction(String name,
Object[] args)
Executes a function from the Script's code
|
Object |
invokeMethod(Object obj,
String name,
Object[] args)
Executes a method from the Script's code
|
void |
load(ScriptingFolder folder,
String id) |
protected void |
loadInf(Ini prefs) |
Object |
main()
Run the main function of this script.
|
Object |
main(Object... args)
Run the main function of this script.
|
boolean |
move(ScriptingFolder target)
Moves a ScriptingUnitfrom the current directory to the new location.
|
protected void |
notifyErrors(Exception exception,
String command) |
void |
put(String name,
Object value) |
boolean |
remove() |
void |
removeStderrWriter(Writer err) |
void |
removeStdoutWriter(Writer out) |
boolean |
rename(String newId)
Changes the ID of a ScriptingUnit and the name of the files and/or directories associated
|
Object |
run()
Executes the code of a ScriptBaseScript.
|
Object |
run(Object[] args)
Executes the code of a ScriptBaseScript.
|
void |
runAsTask(Object[] args)
Executes the code of a ScriptBaseScript in a separated thread
|
void |
save()
Persists the current status of a ScriptingScript with the content associated.
|
protected void |
save(Ini prefs) |
void |
setCode(String code)
Sets a the code associated with a ScriptingScript.
|
void |
setExtension(String extension) |
protected void |
setLangName(String langName) |
void |
setLibrarySuffix(String librarySuffix) |
void |
setMainName(String mainName)
Stablishes a new main main function in the ScriptingScript's code.
|
getIsolationGroup, isEnabled, setEnabled, setIsolationGroup
addPropertyChangeListener, create, firePropertyChange, firePropertyChangeListener, getCreatedBy, getDescription, getFile, getFileResource, getId, getInfBoolean, getInfInt, getInfString, getInfValue, getManager, getName, getParent, getProperties, getProperty, getTypeName, getVersion, isSaved, setCreatedBy, setDescription, setId, setName, setParent, setProperty, setSaved, setVersion, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getIsolationGroup, isEnabled, setEnabled, setIsolationGroup
addPropertyChangeListener, getCreatedBy, getDescription, getFile, getId, getName, getParent, getProperties, getProperty, getTypeName, getVersion, isSaved, setCreatedBy, setDescription, setName, setProperty, setSaved, setVersion
getName, getTypeName
protected String langName
protected String extension
protected String librarySuffix
protected ScriptEngine engine
protected CompiledScript compiledCode
protected DefaultScriptingScript(ScriptingFolder parent, String typename, ScriptingManager manager, String id)
public DefaultScriptingScript(ScriptingFolder parent, ScriptingManager manager, String id)
public void addStdoutWriter(Writer out)
addStdoutWriter
in interface ScriptingBaseScript
public void addStderrWriter(Writer err)
addStderrWriter
in interface ScriptingBaseScript
public void removeStdoutWriter(Writer out)
removeStdoutWriter
in interface ScriptingBaseScript
public void removeStderrWriter(Writer err)
removeStderrWriter
in interface ScriptingBaseScript
public Object __call__()
public DefaultScriptingScript.OutputWriter getStdout()
public DefaultScriptingScript.OutputWriter getStderr()
public String getCode()
ScriptingScript
getCode
in interface ScriptingScript
getCode
in interface Script
public void setCode(String code)
ScriptingScript
setCode
in interface ScriptingScript
code
- String that contains the new code.public String getLibrarySuffix()
getLibrarySuffix
in interface ScriptingBaseScript
public void setLibrarySuffix(String librarySuffix)
setLibrarySuffix
in interface ScriptingBaseScript
protected String getCodeToInitializeEngine()
public ScriptEngine getEngine()
protected void loadInf(Ini prefs)
loadInf
in class AbstractScript
public void load(ScriptingFolder folder, String id)
load
in interface Unit
load
in class AbstractUnit
public void save()
ScriptingScript
save
in interface ScriptingScript
protected void save(Ini prefs)
save
in class AbstractScript
public String getLangName()
ScriptingScript
getLangName
in interface ScriptingScript
protected void setLangName(String langName)
public String[] getIconNames()
ScriptingUnit
getIconNames
in interface ScriptingUnit
public String getMainName()
ScriptingScript
getMainName
in interface ScriptingScript
public void setMainName(String mainName)
ScriptingScript
setMainName
in interface ScriptingScript
mainName
- String that contains the new main function name.public List<File> getFiles()
ScriptingUnit
getFiles
in interface ScriptingUnit
public String getExtension()
public void setExtension(String extension)
public void addObserver(Observer o)
addObserver
in interface Observable
public void deleteObserver(Observer o)
deleteObserver
in interface Observable
public void deleteObservers()
deleteObservers
in interface Observable
public void put(String name, Object value)
put
in interface ScriptingBaseScript
put
in interface Script
public void compile()
compile
in interface ScriptingBaseScript
public void addDisposable(Disposable disposable)
public Object main()
public Object main(Object... args)
args
- public Object run()
ScriptingBaseScript
run
in interface ScriptingBaseScript
public Object run(Object[] args)
ScriptingBaseScript
run
in interface ScriptingBaseScript
args
- Contains the input parameters to run the ScriptBaseScript.public Object invokeFunction(String name, Object[] args)
ScriptingScript
invokeFunction
in interface ScriptingScript
invokeFunction
in interface Script
name
- method's name to executeargs
- input parameters of the methodpublic File getScriptFile()
getScriptFile
in interface ScriptingBaseScript
public Object invokeMethod(Object obj, String name, Object[] args) throws NoSuchMethodException
ScriptingScript
invokeMethod
in interface ScriptingScript
obj
- this Object represents the script's codename
- method's name to executeargs
- input parameters of the methodNoSuchMethodException
- If there isn't a main function to begin the executionpublic File getResource(String filename)
ScriptingBaseScript
getResource
in interface ScriptingBaseScript
public String getMimeType()
getMimeType
in interface ScriptingScript
protected void console_println(String s)
console_println
in class AbstractUnit
public void runAsTask(Object[] args)
ScriptingBaseScript
runAsTask
in interface ScriptingBaseScript
args
- Contains the input parameters to run the ScriptBaseScript.public boolean remove()
remove
in interface ScriptingUnit
public void create(ScriptingFolder folder, String id, String language)
public String getNewTemplate()
public ScriptingUnit get(String name)
public ScriptingUnit get(File file)
public boolean move(ScriptingFolder target)
ScriptingUnit
move
in interface ScriptingUnit
target
- ScriptingFolder
that represents the destination..public boolean rename(String newId)
ScriptingUnit
rename
in interface ScriptingUnit
newId
- String that contains the new Id.