Class FunctorScript
- java.lang.Object
-
- edu.uiuc.ncsa.security.util.functor.parser.FunctorScript
-
- All Implemented Interfaces:
ScriptInterface
,Serializable
- Direct Known Subclasses:
Script
public class FunctorScript extends Object implements ScriptInterface
Created by Jeff Gaynor
on 3/7/19 at 6:52 PM- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
SCRIPT_KEY
-
Constructor Summary
Constructors Constructor Description FunctorScript(JFunctorFactory functorFactory)
FunctorScript(JFunctorFactory functorFactory, net.sf.json.JSONObject rawContent)
Use this to initialize the entire parser in advance of execution.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
checkVersion()
protected EventDrivenParser
createParser()
void
execute()
void
execute(StateInterface state)
Run this script with the given state.void
execute(File file)
Executes a file.void
execute(Reader reader)
void
execute(List<String> commands)
void
execute(net.sf.json.JSONObject rawContent)
Figure out what type of object is to be executed.protected void
executeJSON(net.sf.json.JSONObject rawContent)
Execute the old JSON functor and put it into a script object.protected void
executeScript(List<String> commands)
protected void
executeScript(net.sf.json.JSONObject rawContent)
FunctorMap
getFunctorMap()
List<AbstractHandler>
getHandlers()
LogicBlocks<? extends LogicBlock>
getLogicBlocks()
XProperties
getProperties()
Properties the system may need about this script.boolean
hasHandlers()
boolean
hasLogicBlocks()
String
toString()
-
-
-
Field Detail
-
SCRIPT_KEY
public static String SCRIPT_KEY
-
-
Constructor Detail
-
FunctorScript
public FunctorScript(JFunctorFactory functorFactory)
-
FunctorScript
public FunctorScript(JFunctorFactory functorFactory, net.sf.json.JSONObject rawContent)
Use this to initialize the entire parser in advance of execution. You may then execute it by simply invoking theexecute()
method when you need to.- Parameters:
functorFactory
-rawContent
-
-
-
Method Detail
-
execute
public void execute(File file)
Executes a file.- Parameters:
file
-
-
execute
public void execute(Reader reader)
-
hasHandlers
public boolean hasHandlers()
-
getHandlers
public List<AbstractHandler> getHandlers()
-
createParser
protected EventDrivenParser createParser()
-
getFunctorMap
public FunctorMap getFunctorMap()
-
checkVersion
protected void checkVersion()
-
getProperties
public XProperties getProperties()
Description copied from interface:ScriptInterface
Properties the system may need about this script. These are not set here but are determined by the needs of theScriptRuntimeEngine
and the language. At the least, they should included a language and language version, plus some identifier.- Specified by:
getProperties
in interfaceScriptInterface
- Returns:
-
execute
public void execute()
-
execute
public void execute(net.sf.json.JSONObject rawContent)
Figure out what type of object is to be executed. Then run it.- Throws:
Throwable
-
executeScript
protected void executeScript(net.sf.json.JSONObject rawContent)
-
hasLogicBlocks
public boolean hasLogicBlocks()
-
executeJSON
protected void executeJSON(net.sf.json.JSONObject rawContent)
Execute the old JSON functor and put it into a script object. The pre-supposes that the content is functor notation and the functor factory will unscramble it. Then we just execute the result. The scripting notation is in a JSONObject of the form{"script":[array of lines as they are in a command file]}
So be sure you are sending that if this method executes for no apparent reason. If the argument is not in the above form, it falls through to this case since it can be hard to figure out and the factory is good at that.- Parameters:
rawContent
-
-
getLogicBlocks
public LogicBlocks<? extends LogicBlock> getLogicBlocks()
-
execute
public void execute(StateInterface state)
Description copied from interface:ScriptInterface
Run this script with the given state.- Specified by:
execute
in interfaceScriptInterface
-
-