Skip to content
This repository has been archived by the owner on Apr 8, 2019. It is now read-only.

Commit

Permalink
GTNPORTAL-3250: The portlets cannot be displayed after a portal reload
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Filotto authored and ppalaga committed Oct 16, 2013
1 parent 0be764a commit 3f281b2
Showing 1 changed file with 19 additions and 2 deletions.
Expand Up @@ -22,9 +22,9 @@
import org.exoplatform.commons.utils.PropertyManager;
import org.exoplatform.container.ExoContainer;
import org.exoplatform.container.ExoContainerContext;
import org.exoplatform.portal.pc.aspects.PortletLifecyclePhaseInterceptor;
import org.exoplatform.services.resources.PortletConfigRegistry;
import org.exoplatform.services.resources.ResourceBundleService;
import org.exoplatform.portal.pc.aspects.PortletLifecyclePhaseInterceptor;
import org.gatein.common.logging.Logger;
import org.gatein.common.logging.LoggerFactory;
import org.gatein.pc.api.PortletInvoker;
Expand Down Expand Up @@ -71,6 +71,11 @@ public class ExoKernelIntegration implements Startable, WebAppListener {
/** DO NOT REMOVE ME, OTHERWISE YOU'LL BREAK THINGS. */
private final ResourceBundleService resourceBundleService;

/**
* Indicates whether or not the producerPortletInvoker has been registered from this class
*/
private boolean producerPortletInvokerSet;

/** . */
private Logger log = LoggerFactory.getLogger(ExoKernelIntegration.class);

Expand Down Expand Up @@ -171,6 +176,7 @@ public void start() {
// register the producer portlet invoker if it hasn't been already
if (!federatingPortletInvoker.isResolved(PortletInvoker.LOCAL_PORTLET_INVOKER_ID)) {
federatingPortletInvoker.registerInvoker(PortletInvoker.LOCAL_PORTLET_INVOKER_ID, producerPortletInvoker);
producerPortletInvokerSet = true;
}

// The consumer portlet invoker
Expand All @@ -191,13 +197,24 @@ public void start() {

public void stop() {
ServletContainerFactory.getServletContainer().removeWebAppListener(this);
if (!producerPortletInvokerSet || !PropertyManager.isDevelopping()) {
// The current instance did not register the producerPortletInvoker so we have nothing to do or we are not in
// developing mode
return;
}
final ExoContainer topContainer = ExoContainerContext.getTopContainer();
FederatingPortletInvoker federatingPortletInvoker = (FederatingPortletInvoker) topContainer
.getComponentInstanceOfType(FederatingPortletInvoker.class);
if (federatingPortletInvoker != null && federatingPortletInvoker.isResolved(PortletInvoker.LOCAL_PORTLET_INVOKER_ID)) {
// The current instance registered the producerPortletInvoker so we have to unregister it
federatingPortletInvoker.unregisterInvoker(PortletInvoker.LOCAL_PORTLET_INVOKER_ID);
}
}

public PortletApplicationDeployer getPortletApplicationRegistry() {
return portletApplicationRegistry;
}

@Override
public void onEvent(WebAppEvent event) {
if (event instanceof WebAppLifeCycleEvent) {
WebAppLifeCycleEvent lifeCycleEvent = (WebAppLifeCycleEvent) event;
Expand Down

0 comments on commit 3f281b2

Please sign in to comment.