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, isolationchangeListener, createdBy, description, id, manager, name, parent, saved, typename, versionISOLATION_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.
|
getIsolation, isEnabled, setEnabled, setIsolationaddPropertyChangeListener, create, firePropertyChange, firePropertyChangeListener, getCreatedBy, getDescription, getFile, getFileResource, getId, getInfBoolean, getInfInt, getInfString, getInfValue, getManager, getName, getParent, getTypeName, getVersion, isSaved, setCreatedBy, setDescription, setId, setName, setParent, setSaved, setVersion, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetIsolation, isEnabled, setEnabled, setIsolationaddPropertyChangeListener, getCreatedBy, getDescription, getFile, getId, getName, getParent, getTypeName, getVersion, isSaved, setCreatedBy, setDescription, setName, setSaved, setVersiongetName, getTypeNameprotected 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 ScriptingBaseScriptpublic void addStderrWriter(Writer err)
addStderrWriter in interface ScriptingBaseScriptpublic void removeStdoutWriter(Writer out)
removeStdoutWriter in interface ScriptingBaseScriptpublic void removeStderrWriter(Writer err)
removeStderrWriter in interface ScriptingBaseScriptpublic Object __call__()
public DefaultScriptingScript.OutputWriter getStdout()
public DefaultScriptingScript.OutputWriter getStderr()
public String getCode()
ScriptingScriptgetCode in interface ScriptingScriptgetCode in interface Scriptpublic void setCode(String code)
ScriptingScriptsetCode in interface ScriptingScriptcode - String that contains the new code.public String getLibrarySuffix()
getLibrarySuffix in interface ScriptingBaseScriptpublic void setLibrarySuffix(String librarySuffix)
setLibrarySuffix in interface ScriptingBaseScriptprotected String getCodeToInitializeEngine()
public ScriptEngine getEngine()
protected void loadInf(Ini prefs)
loadInf in class AbstractScriptpublic void load(ScriptingFolder folder, String id)
load in interface Unitload in class AbstractUnitpublic void save()
ScriptingScriptsave in interface ScriptingScriptprotected void save(Ini prefs)
save in class AbstractScriptpublic String getLangName()
ScriptingScriptgetLangName in interface ScriptingScriptprotected void setLangName(String langName)
public String[] getIconNames()
ScriptingUnitgetIconNames in interface ScriptingUnitpublic String getMainName()
ScriptingScriptgetMainName in interface ScriptingScriptpublic void setMainName(String mainName)
ScriptingScriptsetMainName in interface ScriptingScriptmainName - String that contains the new main function name.public List<File> getFiles()
ScriptingUnitgetFiles in interface ScriptingUnitpublic String getExtension()
public void setExtension(String extension)
public void addObserver(Observer o)
addObserver in interface Observablepublic void deleteObserver(Observer o)
deleteObserver in interface Observablepublic void deleteObservers()
deleteObservers in interface Observablepublic void put(String name, Object value)
put in interface ScriptingBaseScriptput in interface Scriptpublic void compile()
compile in interface ScriptingBaseScriptpublic void addDisposable(Disposable disposable)
public Object main()
public Object main(Object... args)
args - public Object run()
ScriptingBaseScriptrun in interface ScriptingBaseScriptpublic Object run(Object[] args)
ScriptingBaseScriptrun in interface ScriptingBaseScriptargs - Contains the input parameters to run the ScriptBaseScript.public Object invokeFunction(String name, Object[] args)
ScriptingScriptinvokeFunction in interface ScriptingScriptinvokeFunction in interface Scriptname - method's name to executeargs - input parameters of the methodpublic File getScriptFile()
getScriptFile in interface ScriptingBaseScriptpublic Object invokeMethod(Object obj, String name, Object[] args) throws NoSuchMethodException
ScriptingScriptinvokeMethod in interface ScriptingScriptobj - 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)
ScriptingBaseScriptgetResource in interface ScriptingBaseScriptpublic String getMimeType()
getMimeType in interface ScriptingScriptprotected void console_println(String s)
console_println in class AbstractUnitpublic void runAsTask(Object[] args)
ScriptingBaseScriptrunAsTask in interface ScriptingBaseScriptargs - Contains the input parameters to run the ScriptBaseScript.public boolean remove()
remove in interface ScriptingUnitpublic 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)
ScriptingUnitmove in interface ScriptingUnittarget - ScriptingFolder that represents the destination..public boolean rename(String newId)
ScriptingUnitrename in interface ScriptingUnitnewId - String that contains the new Id.