Ejemplo n.º 1
0
  @Override
  public synchronized void fireDeployEvent(final HotDeployEvent hotDeployEvent) {

    PortalLifecycleUtil.register(
        new HotDeployPortalLifecycle(hotDeployEvent), PortalLifecycle.METHOD_INIT);

    if (_capturePrematureEvents) {

      // Capture events that are fired before the portal initialized

      PortalLifecycle portalLifecycle =
          new BasePortalLifecycle() {

            @Override
            protected void doPortalDestroy() {}

            @Override
            protected void doPortalInit() {
              fireDeployEvent(hotDeployEvent);
            }
          };

      PortalLifecycleUtil.register(portalLifecycle, PortalLifecycle.METHOD_INIT);
    } else {

      // Fire event

      doFireDeployEvent(hotDeployEvent);
    }
  }
Ejemplo n.º 2
0
  /** @see SetupWizardUtil#_initPlugins */
  protected void initPlugins() throws Exception {

    // See LEP-2885. Don't flush hot deploy events until after the portal
    // has initialized.

    if (SetupWizardUtil.isSetupFinished()) {
      HotDeployUtil.setCapturePrematureEvents(false);

      PortalLifecycleUtil.flushInits();
    }
  }
Ejemplo n.º 3
0
  @Override
  public void destroy() {
    if (_log.isDebugEnabled()) {
      _log.debug("Destroy plugins");
    }

    PortalLifecycleUtil.flushDestroys();

    List<Portlet> portlets = PortletLocalServiceUtil.getPortlets();

    if (_log.isDebugEnabled()) {
      _log.debug("Destroy portlets");
    }

    try {
      destroyPortlets(portlets);
    } catch (Exception e) {
      _log.error(e, e);
    }

    if (_log.isDebugEnabled()) {
      _log.debug("Destroy companies");
    }

    try {
      destroyCompanies();
    } catch (Exception e) {
      _log.error(e, e);
    }

    if (_log.isDebugEnabled()) {
      _log.debug("Process global shutdown events");
    }

    try {
      processGlobalShutdownEvents();
    } catch (Exception e) {
      _log.error(e, e);
    }

    if (_log.isDebugEnabled()) {
      _log.debug("Destroy");
    }

    callParentDestroy();
  }
  @Override
  public Object doBeforeClass(Description description) {
    if (_mainServlet == null) {
      final MockServletContext mockServletContext =
          new AutoDeployMockServletContext(new FileSystemResourceLoader());

      PortalLifecycleUtil.register(
          new PortalLifecycle() {

            @Override
            public void portalInit() {
              ModuleFrameworkUtilAdapter.registerContext(mockServletContext);
            }

            @Override
            public void portalDestroy() {}
          });

      ServletContextPool.put(StringPool.BLANK, mockServletContext);

      MockServletConfig mockServletConfig = new MockServletConfig(mockServletContext);

      _mainServlet = new MainServlet();

      try {
        _mainServlet.init(mockServletConfig);
      } catch (ServletException se) {
        throw new RuntimeException("The main servlet could not be initialized");
      }

      ServiceTestUtil.initStaticServices();
    }

    ServiceTestUtil.initServices();

    ServiceTestUtil.initPermissions();

    return null;
  }
Ejemplo n.º 5
0
  /** @see {@link com.liferay.portal.servlet.MainServlet#initPlugins} */
  private static void _initPlugins() {
    HotDeployUtil.setCapturePrematureEvents(false);

    PortalLifecycleUtil.flushInits();
  }