コード例 #1
0
 /** {@inheritDoc} */
 @Override
 protected void writeActiveResource(IActiveResource resource, OutputStream outputStream)
     throws IOException {
   IBackendController backendController = BackendControllerHolder.getCurrentBackendController();
   AbstractBackendController slaveBackendController =
       (AbstractBackendController) backendController.createBackendController();
   AsyncActionExecutor executor =
       new AsyncActionExecutor(
           new AsyncExportAction(resource, outputStream),
           new HashMap<String, Object>(),
           null,
           slaveBackendController);
   // execute synchronously in the thread
   try {
     executor.run();
   } catch (RuntimeException ex) {
     if (ex.getCause() instanceof IOException) {
       throw (IOException) ex.getCause();
     } else {
       throw ex;
     }
   }
   // Do not cleanup the session backend controller since it can be used by a GUI thread. See bug
   // #75.
   // backendController.cleanupRequestResources();
 }
コード例 #2
0
 /** Programmatically stops the application and performs all necessary cleanups. */
 public void stop() {
   // Breaks SSO. Useless to perform before garbage collecting.
   // if (frontendController != null) {
   // frontendController.stop();
   // }
   frontendController = null;
   BackendControllerHolder.setSessionBackendController(null);
 }
コード例 #3
0
 /**
  * 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);
 }