public ScriptEnvironment getEnvironment ( String environmentName ) { Preconditions . checkArgument ( StringUtils . isNotNullOrBlank ( environmentName ) , "Environment name cannot be null or empty" ) ; ScriptEngine engine = engineManager . getEngineByName ( environmentName ) ; Preconditions . checkArgument ( engine != null , environmentName + " is an unknown." ) ; environmentName = engine . getFactory ( ) . getEngineName ( ) ; if ( ! environments . containsKey ( environmentName ) ) { environments . put ( environmentName , new ScriptEnvironment ( engine ) ) ; } return environments . get ( environmentName ) ; }
Gets the scripting environment given the environment name .