Package org.gatein.wci

Examples of org.gatein.wci.WebAppLifeCycleEvent


   public void onEvent(WebAppEvent event)
   {
      if (event instanceof WebAppLifeCycleEvent)
      {
         WebAppLifeCycleEvent lifeCycleEvent = (WebAppLifeCycleEvent)event;
         String cp = event.getWebApp().getContextPath();
         switch (lifeCycleEvent.getType())
         {
            case WebAppLifeCycleEvent.ADDED:
               log.debug("Going to install war file" + cp);
               add(event.getWebApp());
               log.debug("Installed war file" + cp);
View Full Code Here


    */
   public void onEvent(WebAppEvent event)
   {
      if (event instanceof WebAppLifeCycleEvent && !stopping.get())
      {
         WebAppLifeCycleEvent waEvent = (WebAppLifeCycleEvent)event;
         if (waEvent.getType() == WebAppLifeCycleEvent.REMOVED)
         {
            String contextName = event.getWebApp().getServletContext().getServletContextName();
            boolean updated = false;
            for (Entry<String, ConcurrentMap<String, Queue<PortalContainerInitTaskContext>>> entry : initTasks.entrySet())
            {
               String portalContainer = entry.getKey();
               ConcurrentMap<String, Queue<PortalContainerInitTaskContext>> queues = entry.getValue();
               for (Queue<PortalContainerInitTaskContext> queue : queues.values())
               {
                  for (Iterator<PortalContainerInitTaskContext> it = queue.iterator(); it.hasNext();)
                  {
                     PortalContainerInitTaskContext context = it.next();
                     if (context.getServletContextName().equals(contextName))
                     {
                        it.remove();
                        updated = true;
                        if (portalContainer2Reload.contains(portalContainer))
                        {
                           // The current portal container is already part of the portal containers to be reloaded to so need to continue
                           // at that point.
                           lastUpdateTime.set(System.currentTimeMillis());
                           continue;
                        }
                        final PortalContainer container = getPortalContainer(portalContainer);
                        if (container != null)
                        {
                           Set<WebAppInitContext> contexts = container.getWebAppInitContexts();
                           for (WebAppInitContext webappctx : contexts)
                           {
                              ServletContext ctx = webappctx.getServletContext();
                              if (context.getServletContextName().equals(ctx.getServletContextName()))
                              {
                                 // We found a matching servlet context which means that the current servlet context is defined as a
                                 // PortalContainerConfigOwner
                                 portalContainer2Reload.add(portalContainer);
                                 lastUpdateTime.set(System.currentTimeMillis());
                                 // We already found the corresponding servlet context no need to continue
                                 break;
                              }
                           }
                        }
                     }
                  }
               }
            }
            if (updated)
            {
               LOG.info("The webapp '" + contextName + "' has been undeployed, the related init tasks have been removed");
            }
         }
         else if (waEvent.getType() == WebAppLifeCycleEvent.ADDED && lastUpdateTime.get() > 0 && reloadingThread == null)
         {
            // Reloading thread used to reload asynchronously the containers
            reloadingThread = new Thread("Reloading")
            {
               @Override
View Full Code Here

    }

    public void onEvent(WebAppEvent event) {
        // TODO Auto-generated method stub
        if (event instanceof WebAppLifeCycleEvent) {
            WebAppLifeCycleEvent waEvent = (WebAppLifeCycleEvent) event;
            if (waEvent.getType() == WebAppLifeCycleEvent.REMOVED) {
                String webApp = event.getWebApp().getServletContext().getContextPath();
                removeWebAppSkin(webApp);
                removeContextAppSkin(event.getWebApp());
            }
        }
View Full Code Here

    */
   public void onEvent(WebAppEvent event)
   {
      if (event instanceof WebAppLifeCycleEvent && !stopping.get())
      {
         WebAppLifeCycleEvent waEvent = (WebAppLifeCycleEvent)event;
         if (waEvent.getType() == WebAppLifeCycleEvent.REMOVED)
         {
            String contextName = ContainerUtil.getServletContextName(event.getWebApp().getServletContext());
            boolean updated = false;
            for (Entry<String, ConcurrentMap<String, Queue<PortalContainerInitTaskContext>>> entry : initTasks.entrySet())
            {
               String portalContainer = entry.getKey();
               ConcurrentMap<String, Queue<PortalContainerInitTaskContext>> queues = entry.getValue();
               for (Queue<PortalContainerInitTaskContext> queue : queues.values())
               {
                  for (Iterator<PortalContainerInitTaskContext> it = queue.iterator(); it.hasNext();)
                  {
                     PortalContainerInitTaskContext context = it.next();
                     if (context.getServletContextName().equals(contextName))
                     {
                        it.remove();
                        updated = true;
                        if (portalContainer2Reload.contains(portalContainer))
                        {
                           // The current portal container is already part of the portal containers to be reloaded to so need to continue
                           // at that point.
                           lastUpdateTime.set(System.currentTimeMillis());
                           continue;
                        }
                        final PortalContainer container = getPortalContainer(portalContainer);
                        if (container != null)
                        {
                           Set<WebAppInitContext> contexts = container.getWebAppInitContexts();
                           for (WebAppInitContext webappctx : contexts)
                           {
                              ServletContext ctx = webappctx.getServletContext();
                              if (context.getServletContextName().equals(ContainerUtil.getServletContextName(ctx)))
                              {
                                 // We found a matching servlet context which means that the current servlet context is defined as a
                                 // PortalContainerConfigOwner
                                 portalContainer2Reload.add(portalContainer);
                                 lastUpdateTime.set(System.currentTimeMillis());
                                 // We already found the corresponding servlet context no need to continue
                                 break;
                              }
                           }
                        }
                     }
                  }
               }
            }
            if (updated)
            {
               LOG.info("The webapp '" + contextName + "' has been undeployed, the related init tasks have been removed");
            }
         }
         else if (waEvent.getType() == WebAppLifeCycleEvent.ADDED && lastUpdateTime.get() > 0 && reloadingThread == null)
         {
            // Reloading thread used to reload asynchronously the containers
            reloadingThread = new Thread("Reloading")
            {
               @Override
View Full Code Here

    */
   public void onEvent(WebAppEvent event)
   {
      if (event instanceof WebAppLifeCycleEvent && !stopping.get())
      {
         WebAppLifeCycleEvent waEvent = (WebAppLifeCycleEvent)event;
         if (waEvent.getType() == WebAppLifeCycleEvent.REMOVED)
         {
            String contextName = event.getWebApp().getServletContext().getServletContextName();
            boolean updated = false;
            for (Entry<String, ConcurrentMap<String, Queue<PortalContainerInitTaskContext>>> entry : initTasks.entrySet())
            {
               String portalContainer = entry.getKey();
               ConcurrentMap<String, Queue<PortalContainerInitTaskContext>> queues = entry.getValue();
               for (Queue<PortalContainerInitTaskContext> queue : queues.values())
               {
                  for (Iterator<PortalContainerInitTaskContext> it = queue.iterator(); it.hasNext();)
                  {
                     PortalContainerInitTaskContext context = it.next();
                     if (context.getServletContextName().equals(contextName))
                     {
                        it.remove();
                        updated = true;
                        if (portalContainer2Reload.contains(portalContainer))
                        {
                           // The current portal container is already part of the portal containers to be reloaded to so need to continue
                           // at that point.
                           lastUpdateTime.set(System.currentTimeMillis());
                           continue;
                        }
                        final PortalContainer container = getPortalContainer(portalContainer);
                        if (container != null)
                        {
                           Set<WebAppInitContext> contexts = container.getWebAppInitContexts();
                           for (WebAppInitContext webappctx : contexts)
                           {
                              ServletContext ctx = webappctx.getServletContext();
                              if (context.getServletContextName().equals(ctx.getServletContextName()))
                              {
                                 // We found a matching servlet context which means that the current servlet context is defined as a
                                 // PortalContainerConfigOwner
                                 portalContainer2Reload.add(portalContainer);
                                 lastUpdateTime.set(System.currentTimeMillis());
                                 // We already found the corresponding servlet context no need to continue
                                 break;
                              }
                           }
                        }
                     }
                  }
               }
            }
            if (updated)
            {
               LOG.info("The webapp '" + contextName + "' has been undeployed, the related init tasks have been removed");
            }
         }
         else if (waEvent.getType() == WebAppLifeCycleEvent.ADDED && lastUpdateTime.get() > 0 && reloadingThread == null)
         {
            // Reloading thread used to reload asynchronously the containers
            reloadingThread = new Thread("Reloading")
            {
               @Override
View Full Code Here

    /**
     * @see org.gatein.wci.WebAppListener#onEvent(org.gatein.wci.WebAppEvent)
     */
    public void onEvent(WebAppEvent event) {
        if (event instanceof WebAppLifeCycleEvent) {
            WebAppLifeCycleEvent lifeCycleEvent = (WebAppLifeCycleEvent) event;
            WebApp webApp = null;
            URL url = null;
            switch (lifeCycleEvent.getType()) {
                case WebAppLifeCycleEvent.ADDED:
                    webApp = event.getWebApp();
                    url = getGateinResourcesXml(webApp);
                    if (url != null) {
                        add(webApp, url);
View Full Code Here

    }

    @Override
    public void onEvent(WebAppEvent event) {
        if (event instanceof WebAppLifeCycleEvent) {
            WebAppLifeCycleEvent lifeCycleEvent = (WebAppLifeCycleEvent) event;
            ServletContext servletContext = lifeCycleEvent.getWebApp().getServletContext();

            if (WebAppLifeCycleEvent.ADDED == lifeCycleEvent.getType()) {
                InputStream is = servletContext.getResourceAsStream(GateInResourcesDeployer.GATEIN_CONFIG_RESOURCE);
                if (is != null) {
                    servletContext.setAttribute(SUPPORT_GATEIN_RESOURCES, true);
                }
            } else if (servletContext.getAttribute(SUPPORT_GATEIN_RESOURCES) != null
                    && WebAppLifeCycleEvent.REMOVED == lifeCycleEvent.getType()) {
                cache.clear();
                servletContext.removeAttribute(SUPPORT_GATEIN_RESOURCES);
            }
        }
    }
View Full Code Here

        return portletApplicationRegistry;
    }

    public void onEvent(WebAppEvent event) {
        if (event instanceof WebAppLifeCycleEvent) {
            WebAppLifeCycleEvent lifeCycleEvent = (WebAppLifeCycleEvent) event;
            int type = lifeCycleEvent.getType();
            if (type == WebAppLifeCycleEvent.ADDED) {
                try {
                    portletApplicationRegistry.add(lifeCycleEvent.getWebApp().getServletContext());
                } catch (DeploymentException e) {
                    log.error("Portlet deployment failed", e);
                }
            } else if (type == WebAppLifeCycleEvent.REMOVED) {
                portletApplicationRegistry.remove(lifeCycleEvent.getWebApp().getServletContext());
            }
        }
    }
View Full Code Here

   public void onEvent(WebAppEvent event)
   {
      // TODO Auto-generated method stub
      if (event instanceof WebAppLifeCycleEvent)
      {
         WebAppLifeCycleEvent waEvent = (WebAppLifeCycleEvent)event;
         if (waEvent.getType() == WebAppLifeCycleEvent.REMOVED)
         {
            String webApp = event.getWebApp().getServletContext().getContextPath();
            removeWebAppSkin(webApp);
            removeContextAppSkin(event.getWebApp());
         }
View Full Code Here

   public void onEvent(WebAppEvent event)
   {
      if (event instanceof WebAppLifeCycleEvent)
      {
         WebAppLifeCycleEvent lifeCycleEvent = (WebAppLifeCycleEvent)event;
         ServletContext servletContext = lifeCycleEvent.getWebApp().getServletContext();
         switch (lifeCycleEvent.getType())
         {
            case WebAppLifeCycleEvent.ADDED:
               add(event.getWebApp());
               break;
            case WebAppLifeCycleEvent.REMOVED:
View Full Code Here

TOP

Related Classes of org.gatein.wci.WebAppLifeCycleEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.