/** * {@inheritDoc} */ @Override public final void contextInitialized(ServletContextEvent event) { BeanFactory beanFactory = getBeanFactory(event); contextInitialized(beanFactory, event); }
/** * {@inheritDoc} */ @Override public void start() { startController(); }
/** * {@inheritDoc} */ @Override public void contextDestroyed(ServletContextEvent event) { BeanFactory beanFactory = getBeanFactory(event); contextDestroyed(beanFactory, event); }
/** * Executes the backend action. * * @return the action execution status. */ protected boolean executeAction() { return executeAction(getAction(), getActionContext(), createSubject(getUserName()), getStartupLocale()); }
/** * Both front and back controllers are retrieved from the spring context, * associated and started. * <p> * {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public void start() { // start on brand new instances. stop(); IBackendController backendController; try { backendController = (IBackendController) getApplicationContext().getBean( "applicationBackController"); } catch (RuntimeException ex) { LOG.error("applicationBackController could not be instantiated.", ex); throw ex; } try { frontendController = (IFrontendController<E, F, G>) getApplicationContext() .getBean("applicationFrontController"); } catch (RuntimeException ex) { LOG.error("applicationFrontController could not be instantiated.", ex); throw ex; } frontendController.start(backendController, getStartupLocale(), getClientTimeZone()); BackendControllerHolder.setSessionBackendController(backendController); }
/** * {@inheritDoc} */ @Override public void start() { try { super.start(); executeAction(); } finally { IBackendController bc = getBackendController(); if (bc != null) { bc.cleanupRequestResources(); } } }
/** * Back controller is retrieved from the spring context and started. */ protected void startController() { try { // start on brand new instance. IBackendController backendController = (IBackendController) getApplicationContext() .getBean("applicationBackController"); BackendControllerHolder.setThreadBackendController(backendController); backendController.start(getStartupLocale(), getClientTimeZone()); } catch (RuntimeException ex) { LOG.error("applicationBackController could not be instantiated.", ex); throw ex; } }
splashed = true; startup.start(); NativeInterface.runEventPump(); } catch (ParseException ex) {
/** * Creates a user subject. * * @return a user subject. */ protected Subject createSubject() { return createSubject(getUserName()); }
/** * Retrieves the backend action to execute. * * @return the backend action to execute. */ protected BackendAction getAction() { return (BackendAction) getApplicationContext().getBean(getActionBeanId()); }
/** * Executes a backend action. * * @param action * the backend action to execute. * @param initialContext * the initial action context. * @param subject * the JAAS subject to execute the action for. * @param locale * the locale used to execute the action. * @return true if the action execution was successful. */ protected boolean executeAction(BackendAction action, Map<String, Object> initialContext, Subject subject, Locale locale) { configureApplicationSession(subject, locale); Map<String, Object> startupActionContext = new HashMap<>(); startupActionContext.putAll(getBackendController() .getInitialActionContext()); startupActionContext.putAll(initialContext); boolean success = getBackendController().execute(action, startupActionContext); return success; }
private BeanFactory getBeanFactory(ServletContextEvent event) { String beanFactorySelector = getBeanFactorySelector(event); String applicationContextKey = getApplicationContextKey(event); BeanFactoryLocator bfl = SingletonBeanFactoryLocator .getInstance(beanFactorySelector); BeanFactoryReference bf = bfl.useBeanFactory(applicationContextKey); BeanFactory beanFactory = bf.getFactory(); if (beanFactory instanceof ConfigurableApplicationContext) { ((ConfigurableApplicationContext) beanFactory).registerShutdownHook(); } return beanFactory; }
/** * Gets the applicationContext. * * @return the applicationContext. */ protected BeanFactory getApplicationContext() { try { if (applicationContext == null) { synchronized (LOCK) { if (applicationContext == null) { BeanFactoryLocator bfl = SingletonBeanFactoryLocator.getInstance(getBeanFactorySelector()); BeanFactoryReference bf = bfl.useBeanFactory(getApplicationContextKey()); BeanFactory tempApplicationContext = bf.getFactory(); if (tempApplicationContext instanceof ConfigurableApplicationContext) { ((ConfigurableApplicationContext) tempApplicationContext).registerShutdownHook(); } applicationContext = tempApplicationContext; } } } return applicationContext; } catch (RuntimeException ex) { LOG.error("{} context could not be instantiated.", getApplicationContextKey(), ex); throw ex; } }
/** * Registers the controller in the http session. * <p> * {@inheritDoc} */ @Override public void start() { if (System.getProperty("java.security.auth.login.config") == null && HttpRequestHolder.isAvailable()) { System.setProperty("java.security.auth.login.config", ResourceProviderServlet.computeStaticUrl("conf/jaas.config")); } super.start(); if (HttpRequestHolder.isAvailable()) { HttpSession session = HttpRequestHolder.getServletRequest().getSession(); if (session != null) { session.setAttribute(RemotePeerRegistryServlet.PEER_REGISTRY, getFrontendController()); session.setAttribute(RemoteUtilServlet.REMOTE_STARTUP, this); } } }
/** * Sets the batchUserName. * * @param batchUserName * the batchUserName to set. * @deprecated use setUserName instead. */ @Deprecated public void setBatchUserName(String batchUserName) { setUserName(batchUserName); }
/** * Configures session on the backend controller. * * @param subject * the JAAS subject containing the user principal. * @param locale * the locale to use. */ protected void configureApplicationSession(Subject subject, Locale locale) { IApplicationSession session = getBackendController() .getApplicationSession(); session.setSubject(subject); session.setLocale(locale); }
splashed = true; startup.start(); } catch (ParseException ex) { System.err.println(ex.getLocalizedMessage());