Package org.gatein.wci

Examples of org.gatein.wci.WebAppLifeCycleEvent


   public void onEvent(final WebAppEvent event)
   {
      if (event instanceof WebAppLifeCycleEvent)
      {
         WebAppLifeCycleEvent waEvent = (WebAppLifeCycleEvent)event;
         if (waEvent.getType() == WebAppLifeCycleEvent.ADDED)
         {
            ServletContext scontext = null;
            InputStream is = null;
            try
            {
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();
                        portalContainer2Reload.add(portalContainer);
                        updated = true;
                        lastUpdateTime.set(System.currentTimeMillis());
                     }
                  }
               }
            }
            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

        this.gadgetRegistryService = (GadgetRegistryServiceImpl) gadgetRegistryService;
    }

    public void onEvent(WebAppEvent webAppEvent) {
        if (webAppEvent instanceof WebAppLifeCycleEvent) {
            WebAppLifeCycleEvent lfEvent = (WebAppLifeCycleEvent) webAppEvent;
            if (lfEvent.getType() == WebAppLifeCycleEvent.ADDED) {
                WebApp webApp = webAppEvent.getWebApp();
                ServletContext scontext = webApp.getServletContext();
                try {
                    final URL url = scontext.getResource("/WEB-INF/gadget.xml");
                    if (url != null) {
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(JavascriptConfigDeployer.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

        this.gadgetRegistryService = (GadgetRegistryServiceImpl) gadgetRegistryService;
    }

    public void onEvent(WebAppEvent webAppEvent) {
        if (webAppEvent instanceof WebAppLifeCycleEvent) {
            WebAppLifeCycleEvent lfEvent = (WebAppLifeCycleEvent) webAppEvent;
            if (lfEvent.getType() == WebAppLifeCycleEvent.ADDED) {
                WebApp webApp = webAppEvent.getWebApp();
                ServletContext scontext = webApp.getServletContext();
                try {
                    final URL url = scontext.getResource("/WEB-INF/gadget.xml");
                    if (url != null) {
View Full Code Here

         }
         webAppListeners.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 (webAppListeners.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

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.