Init execution context for script variables bindings.

@param event the BeforeExecutionEvent
962174
@Override
    public void onBeforeExecutionEvent(BeforeExecutionEvent event) {
        LepManager manager = event.getSource();
        ScopedContext threadContext = manager.getContext(ContextScopes.THREAD);
        if (threadContext == null) {
            throw new IllegalStateException("LEP manager thread context doesn't initialized");
        }

        TenantContext tenantContext = getRequiredValue(threadContext, THREAD_CONTEXT_KEY_TENANT_CONTEXT,
                                                       TenantContext.class);
        XmAuthenticationContext authContext = getRequiredValue(threadContext, THREAD_CONTEXT_KEY_AUTH_CONTEXT,
                                                               XmAuthenticationContext.class);

        ScopedContext executionContext = manager.getContext(ContextScopes.EXECUTION);
        // add contexts
        executionContext.setValue(BINDING_KEY_TENANT_CONTEXT, tenantContext);
        executionContext.setValue(BINDING_KEY_AUTH_CONTEXT, authContext);

        bindExecutionContext(executionContext);
    }
1355965
public function init(MvcEvent $event): void
    {
        if (true === $this->tracyOptions->getEnabled()) {
            Debugger::enable($this->tracyOptions->getMode());

            if (null !== $this->tracyOptions->getEmail()) {
                Debugger::$email = $this->tracyOptions->getEmail();
            }

            if (null !== $this->tracyOptions->getLogDirectory()) {
                Debugger::$logDirectory = $this->tracyOptions->getLogDirectory();
            }

            if (null !== $this->tracyOptions->getLogSeverity()) {
                Debugger::$logSeverity = $this->tracyOptions->getLogSeverity();
            }

            if (null !== $this->tracyOptions->getMaxDepth()) {
                Debugger::$maxDepth = $this->tracyOptions->getMaxDepth();
            }

            if (null !== $this->tracyOptions->getMaxLength()) {
                Debugger::$maxLength = $this->tracyOptions->getMaxLength();
            }

            if (null !== $this->tracyOptions->getShowBar()) {
                Debugger::$showBar = $this->tracyOptions->getShowBar();
            }

            if (null !== $this->tracyOptions->getShowLocation()) {
                Debugger::$showLocation = $this->tracyOptions->getShowLocation();
            }

            if (null !== $this->tracyOptions->getStrict()) {
                Debugger::$strictMode = $this->tracyOptions->getStrict();
            }
        }
    }
937281
public function beforeJavascriptStep($event)
    {
        /** @var \Behat\Behat\Hook\Scope\BeforeStepScope $event */
        // Make sure the feature is registered in case this hook fires before
        // ::registerFeature() which is also a @BeforeStep. Behat doesn't
        // support ordering hooks.
        $this->registerFeature($event);
        if (!$this->hasTag('javascript')) {
            return;
        }
        $text = $event->getStep()->getText();
        if (preg_match('/(follow|press|click|submit)/i', $text)) {
            $this->iWaitForAjaxToFinish($event);
        }
    }
1296243
protected void initializeVariable(VariableInstanceEntity e) {
    if (Context.getCommandContext() != null && e != null && e.getType() != null) {
      e.getValue();

      // make sure JPA entities are cached for later retrieval
      if (JPAEntityVariableType.TYPE_NAME.equals(e.getType().getTypeName()) || JPAEntityListVariableType.TYPE_NAME.equals(e.getType().getTypeName())) {
        ((CacheableVariable) e.getType()).setForceCacheable(true);
      }
    }
  }
980738
@Override
	public void contextInitialized(ServletContextEvent sce) {
		Gig.bootstrap(sce.getServletContext());
		Jaguar.assemble(this);
	}
1144005
private void processEventParameter(Expression expression, NameExpr nameExpr,
      List<VariableInfo> parameters) {
    Optional<Node> parentNode = nameExpr.getParentNode();
    if (parentNode.isPresent() && parentNode.get() instanceof CastExpr) {
      CastExpr castExpr = (CastExpr) parentNode.get();
      parameters.add(new VariableInfo(castExpr.getType().toString(), "$event"));
    } else {
      logger.error(
          "\"$event\" should always be casted to it's intended type. Example: @click=\"doSomething((Event) $event)\".",
          expression.toString());
    }
  }
949937
public void init()
    {
        ServletContext config=getServletContext();
        _servletHandler=((ServletHandler.Context)config).getServletHandler();

        Enumeration e = getInitParameterNames();
        while(e.hasMoreElements())
        {
            String param=(String)e.nextElement();
            String value=getInitParameter(param);
            String lvalue=value.toLowerCase();
            if ("nonContextServlets".equals(param))
            {
                _nonContextServlets=value.length()>0 && lvalue.startsWith("t");
            }
            if ("verbose".equals(param))
            {
                _verbose=value.length()>0 && lvalue.startsWith("t");
            }
            else
            {
                if (_parameters==null)
                    _parameters=new HashMap();
                _parameters.put(param,value);
            }
        }
    }
367576
public static void main(String[] args)
    {
        Context cx = Context.enter();
        try {
            // Set version to JavaScript1.2 so that we get object-literal style
            // printing instead of "[object Object]"
            cx.setLanguageVersion(Context.VERSION_1_2);

            // Initialize the standard objects (Object, Function, etc.)
            // This must be done before scripts can be executed.
            Scriptable scope = cx.initStandardObjects();

            // Now we can evaluate a script. Let's create a new object
            // using the object literal notation.
            Object result = cx.evaluateString(scope, "obj = {a:1, b:['x','y']}",
                                              "MySource", 1, null);

            Scriptable obj = (Scriptable) scope.get("obj", scope);

            // Should print "obj == result" (Since the result of an assignment
            // expression is the value that was assigned)
            System.out.println("obj " + (obj == result ? "==" : "!=") +
                               " result");

            // Should print "obj.a == 1"
            System.out.println("obj.a == " + obj.get("a", obj));

            Scriptable b = (Scriptable) obj.get("b", obj);

            // Should print "obj.b[0] == x"
            System.out.println("obj.b[0] == " + b.get(0, b));

            // Should print "obj.b[1] == y"
            System.out.println("obj.b[1] == " + b.get(1, b));

            // Should print {a:1, b:["x", "y"]}
            Function fn = (Function) ScriptableObject.getProperty(obj, "toString");
            System.out.println(fn.call(cx, scope, obj, new Object[0]));
        } finally {
            Context.exit();
        }
    }
709677
@Override
  protected void initializeVariableInstanceBackPointer(VariableInstanceEntity variableInstance) {
    if (processInstanceId != null) {
      variableInstance.setProcessInstanceId(processInstanceId);
    } else {
      variableInstance.setProcessInstanceId(id);
    }
    variableInstance.setExecutionId(id);
  }
1085518
@Override
    public void contextInitialized(final ServletContextEvent servletContextEvent) {
        servletContext = servletContextEvent.getServletContext();

        Latkes.init();
        LOGGER.info("Initializing the context....");

        Latkes.setLocale(Locale.SIMPLIFIED_CHINESE);
        LOGGER.log(Level.INFO, "Default locale [{0}]", Latkes.getLocale());

        final String realPath = servletContext.getRealPath("/");
        LOGGER.log(Level.INFO, "Server [realPath={0}, contextPath={1}]", realPath, servletContext.getContextPath());

        try {
            final Collection<Class<?>> beanClasses = Discoverer.discover(Latkes.getScanPath());
            BeanManager.start(beanClasses);
        } catch (final Exception e) {
            LOGGER.log(Level.ERROR, "Initializes request processors failed", e);

            throw new IllegalStateException("Initializes request processors failed");
        }
    }
1177707
public void init(final IO io, final Variables variables, final Branding branding) {
    this.io = checkNotNull(io);
    this.variables = checkNotNull(variables);
    this.branding = checkNotNull(branding);

    // HACK: more variables shenanigans
    VariablesProvider.set(variables);
  }
44423
public static void whenReady(final String scriptname, final EventListener function) {
    List<EventListener> eventList = JsResources.eventLisenerQueue.get(scriptname);
    if (eventList == null) {
      eventList = new ArrayList<>();
      JsResources.eventLisenerQueue.put(scriptname, eventList);
    }
    eventList.add(function);
    if (BooleanUtils.isTrue(JsResources.initializationStarted.get(scriptname))
        || JsResources.isInHeader(scriptname)) {
      if (JsResources.isInitialized(scriptname)) {
        JsResources.eventLisenerQueue.get(scriptname)
            .forEach(action -> action.handleEvent(JsResources.rememberEvent.get(scriptname)));
        JsResources.eventLisenerQueue.get(scriptname).clear();
      }
      return;
    }
    JsResources.initializationStarted.put(scriptname, Boolean.TRUE);

    final ScriptElement jsScript = Browser.getDocument().createScriptElement();
    if (StringUtils.endsWith(scriptname, ".js")) {
      jsScript.setSrc(scriptname);
    } else {
      jsScript.setInnerHTML(scriptname);
    }
    jsScript.setType(JsResources.SCRIPT_TYPE);

    Browser.getDocument().getHead().appendChild(jsScript);

    jsScript.setOnload(event -> {
      JsResources.eventLisenerQueue.get(scriptname).forEach(action -> action.handleEvent(event));
      JsResources.eventLisenerQueue.get(scriptname).clear();
      JsResources.rememberEvent.put(scriptname, event);
    });
  }
887924
public static void init(Context context, boolean nativeExopackage) {
    try {
      init(context, nativeExopackage ? SOLOADER_ENABLE_EXOPACKAGE : 0);
    } catch (IOException ex) {
      throw new RuntimeException(ex);
    }
  }
1107878
public void init() {
    initConfigurators();
    configuratorsBeforeInit();
    initHistoryLevel();
    initExpressionManager();

    if (usingRelationalDatabase) {
      initDataSource();
    }

    initAgendaFactory();
    initHelpers();
    initVariableTypes();
    initBeans();
    initScriptingEngines();
    initClock();
    initBusinessCalendarManager();
    initCommandContextFactory();
    initTransactionContextFactory();
    initCommandExecutors();
    initServices();
    initIdGenerator();
    initBehaviorFactory();
    initListenerFactory();
    initBpmnParser();
    initProcessDefinitionCache();
    initProcessDefinitionInfoCache();
    initKnowledgeBaseCache();
    initJobHandlers();
    initJobManager();
    initAsyncExecutor();

    initTransactionFactory();

    if (usingRelationalDatabase) {
      initSqlSessionFactory();
    }

    initSessionFactories();
    initDataManagers();
    initEntityManagers();
    initHistoryManager();
    initJpa();
    initDeployers();
    initDelegateInterceptor();
    initEventHandlers();
    initFailedJobCommandFactory();
    initEventDispatcher();
    initProcessValidator();
    initDatabaseEventLogging();
    configuratorsAfterInit();
  }
1234333
@Override
    public final void init(Driver d, Properties properties) {
        this.driver = d;
        this.driver.getEventManager().register(EventManager.EVENT_PROXY_PRE, this);
        this.driver.getEventManager().register(EventManager.EVENT_FRAGMENT_PRE, this);
        this.driver.getEventManager().register(EventManager.EVENT_FRAGMENT_POST, this);

        init(properties);
    }
440551
@Override
  public void contextInitialized(ServletContextEvent servletContextEvent) {
    otherListeners.addAll(getDefaultOtherListeners());

    contextInitialized(servletContextEvent.getServletContext());

    for(ServletContextListener listener : otherListeners) {
      try {
        listener.contextInitialized(servletContextEvent);
      }
      catch(Exception e){
        classLoaderLeakPreventor.error(e);
      }
    }
  }
64601
public function initEvents()
    {
        foreach (array('onShow', 'onShown') as $event) {
            if ($this->$event !== null) {
                $modalEvent = strtolower(substr($event, 2));
                if ($this->$event instanceof CJavaScriptExpression) {
                    $this->events[$modalEvent] = $this->$event;
                } else {
                    $this->events[$modalEvent] = new CJavaScriptExpression($this->$event);
                }
            }
        }
    }