use of io.engineblock.core.ScenarioController in project engineblock by engineblock.
the class Scenario method init.
private void init() {
MetricRegistry metricRegistry = ActivityMetrics.getMetricRegistry();
scriptEngine = engineManager.getEngineByName("nashorn");
scriptEnv = new ScenarioContext(scenarioController);
scriptEngine.setContext(scriptEnv);
scenarioController = new ScenarioController();
progressIndicator = new ProgressIndicator(scenarioController, progressInterval);
scriptEngine.put("scenario", scenarioController);
scriptEngine.put("activities", new ScenarioBindings(scenarioController));
scriptEngine.put("metrics", new MetricRegistryBindings(metricRegistry));
for (ScriptingPluginInfo extensionDescriptor : SandboxExtensionFinder.findAll()) {
if (!extensionDescriptor.isAutoLoading()) {
logger.info("Not loading " + extensionDescriptor + ", autoloading is false");
continue;
}
org.slf4j.Logger extensionLogger = LoggerFactory.getLogger("extensions." + extensionDescriptor.getBaseVariableName());
Object extensionObject = extensionDescriptor.getExtensionObject(extensionLogger, metricRegistry, scriptEnv);
logger.debug("Adding extension object: name=" + extensionDescriptor.getBaseVariableName() + " class=" + extensionObject.getClass().getSimpleName());
scriptEngine.put(extensionDescriptor.getBaseVariableName(), extensionObject);
}
}
Aggregations