Package org.gatein.wci

Examples of org.gatein.wci.WebAppLifeCycleEvent


   public void onEvent(WebAppEvent event)
   {
      if (event instanceof WebAppLifeCycleEvent)
      {
         WebAppLifeCycleEvent lifeCycleEvent = (WebAppLifeCycleEvent)event;
         WebApp webApp = event.getWebApp();
         ServletContext context = webApp.getServletContext();

         // if we see the WSRP admin GUI being deployed or undeployed, inject or remove services
         if (WSRP_ADMIN_GUI_CONTEXT_PATH.equals(webApp.getContextPath()))
         {
            switch (lifeCycleEvent.getType())
            {
               case WebAppLifeCycleEvent.ADDED:
                  context.setAttribute("ConsumerRegistry", consumerRegistry);
                  context.setAttribute("ProducerConfigurationService", producer.getConfigurationService());
                  break;
View Full Code Here


   public void onEvent(WebAppEvent event)
   {
      if (event instanceof WebAppLifeCycleEvent)
      {
         WebAppLifeCycleEvent waEvent = (WebAppLifeCycleEvent)event;
         if (waEvent.getType() == WebAppLifeCycleEvent.ADDED)
         {
            ServletContext scontext = null;
            try
            {
               scontext = event.getWebApp().getServletContext();
View Full Code Here

    */
   public void onEvent(WebAppEvent arg0)
   {
      if (arg0 instanceof WebAppLifeCycleEvent)
      {
         WebAppLifeCycleEvent wevent = (WebAppLifeCycleEvent)arg0;
         if (wevent.getType() == WebAppLifeCycleEvent.REMOVED)
         {
            removeJavascript(wevent.getWebApp().getServletContext());
            refreshJavascript();
         }
      }
   }
View Full Code Here

         }
         listeners.add(listener);
         for (Object response : webAppMap.values())
         {
            WebApp webApp = (WebApp)response;
            WebAppLifeCycleEvent event = new WebAppLifeCycleEvent(webApp, WebAppLifeCycleEvent.ADDED);
            safeFireEvent(listener, event);
         }
         return true;
      }
   }
View Full Code Here

         }
         if (listeners.remove(listener))
         {
            for (WebApp webApp : webAppMap.values())
            {
               WebAppLifeCycleEvent event = new WebAppLifeCycleEvent(webApp, WebAppLifeCycleEvent.REMOVED);
               safeFireEvent(listener, event);
            }
            return true;
         }
         else
View Full Code Here

               {
                  log.debug("Web application " + key + " registration");
                  webAppContext.start();
                  WebAppImpl webApp = new WebAppImpl(webAppContext);
                  container.webAppMap.put(key, webApp);
                  container.fireEvent(new WebAppLifeCycleEvent(webApp, WebAppLifeCycleEvent.ADDED));
                  return true;
               }
               catch (Exception e)
               {
                  log.debug("Was not able to start web app context " + key);
View Full Code Here

            //
            WebAppImpl webApp = container.webAppMap.remove(webAppId);
            if (webApp != null)
            {
               log.debug("Web application " + webAppId + " cleanup");
               container.fireEvent(new WebAppLifeCycleEvent(webApp, WebAppLifeCycleEvent.REMOVED));
               webApp.context.stop();
               return true;
            }
            else
            {
View Full Code Here

         synchronized (container.lock)
         {
            // Unregister all web apps
            for (WebApp webApp : container.webAppMap.values())
            {
               WebAppLifeCycleEvent event = new WebAppLifeCycleEvent(webApp, WebAppLifeCycleEvent.REMOVED);
               container.fireEvent(event);
            }

            //
            container.webAppMap.clear();
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)
   {
      // 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);
         }
      }
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.