Class OScriptManager
java.lang.Object
com.orientechnologies.orient.core.command.script.OScriptManager
Executes Script Commands.
- Author:
- Luca Garulli (l.garulli--(at)--orientdb.com)
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected OCommandManagerprotected ConcurrentHashMap<String,ODatabaseScriptManager> protected static final Stringprotected Stringprotected static final Object[]protected Map<String,ScriptEngineFactory> protected Map<String,Function<String, OScriptExecutor>> protected Map<String,OScriptFormatter> protected Map<String,OScriptResultHandler> protected List<OScriptInjection>protected static final intprotected ScriptEngineManager -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionacquireDatabaseEngine(String databaseName, String language) Acquires a database engine from the pool.voidaddAllowedPackages(Set<String> packages) bind(ScriptEngine scriptEngine, Bindings binding, ODatabaseDocumentInternal db, OCommandContext iContext, Map<Object, Object> iArgs) Deprecated.bindContextVariables(ScriptEngine engine, Bindings binding, ODatabaseDocumentInternal db, OCommandContext iContext, Map<Object, Object> iArgs) voidCloses the pool for a database.voidcloseAll()booleanexistsEngine(String iLanguage) Ask to the Script engine all the formattersgetFunctionDefinition(OFunction iFunction) getFunctionInvoke(OFunction iFunction, Object[] iArgs) getLibrary(ODatabase<?> db, String iLanguage) Formats the library of functions for a language.handleResult(String language, Object result, ScriptEngine engine, Bindings binding, ODatabaseDocument database) registerEngine(String iLanguage, ScriptEngineFactory iEngine) registerFormatter(String iLanguage, OScriptFormatter iFormatterImpl) voidregisterResultHandler(String iLanguage, OScriptResultHandler resultHandler) voidreleaseDatabaseEngine(String iLanguage, String iDatabaseName, ScriptEngine poolEntry) Acquires a database engine from the pool.voidremoveAllowedPackages(Set<String> packages) throwErrorMessage(ScriptException e, String lib) voidunbind(ScriptEngine scriptEngine, Bindings binding, OCommandContext iContext, Map<Object, Object> iArgs) Unbinds variablesvoid
-
Field Details
-
EMPTY_PARAMS
-
LINES_AROUND_ERROR
protected static final int LINES_AROUND_ERROR- See Also:
-
DEF_LANGUAGE
- See Also:
-
defaultLanguage
-
scriptEngineManager
-
engines
-
formatters
-
injections
-
dbManagers
-
handlers
-
executorsFactories
-
commandManager
-
-
Constructor Details
-
OScriptManager
public OScriptManager()
-
-
Method Details
-
getFunctionDefinition
-
getFunctionInvoke
-
getLibrary
Formats the library of functions for a language.- Parameters:
db- Current database instanceiLanguage- Language as filter- Returns:
- String containing all the functions
-
existsEngine
-
getEngine
-
acquireDatabaseEngine
Acquires a database engine from the pool. Once finished using it, the instance MUST be returned in the pool by calling the method #releaseDatabaseEngine(String, ScriptEngine).- Parameters:
databaseName- Database namelanguage- Script language- Returns:
- ScriptEngine instance with the function library already parsed
- See Also:
-
releaseDatabaseEngine
Acquires a database engine from the pool. Once finished using it, the instance MUST be returned in the pool by calling the method- Parameters:
iLanguage- Script languageiDatabaseName- Database namepoolEntry- Pool entry to free- See Also:
-
getSupportedLanguages
-
bindContextVariables
public Bindings bindContextVariables(ScriptEngine engine, Bindings binding, ODatabaseDocumentInternal db, OCommandContext iContext, Map<Object, Object> iArgs) -
bind
@Deprecated public Bindings bind(ScriptEngine scriptEngine, Bindings binding, ODatabaseDocumentInternal db, OCommandContext iContext, Map<Object, Object> iArgs) Deprecated. -
throwErrorMessage
-
unbind
public void unbind(ScriptEngine scriptEngine, Bindings binding, OCommandContext iContext, Map<Object, Object> iArgs) Unbinds variables- Parameters:
binding-
-
registerInjection
-
getAllowedPackages
-
addAllowedPackages
-
removeAllowedPackages
-
unregisterInjection
-
getInjections
-
registerEngine
-
registerFormatter
-
registerResultHandler
-
handleResult
public Object handleResult(String language, Object result, ScriptEngine engine, Bindings binding, ODatabaseDocument database) -
getFormatters
Ask to the Script engine all the formatters- Returns:
- Map containing all the formatters
-
close
Closes the pool for a database. This is called at Orient shutdown and in case a function has been updated.- Parameters:
iDatabaseName-
-
closeAll
public void closeAll() -
getCommandManager
-