Package org.gatein.pc.controller.event

Examples of org.gatein.pc.controller.event.WindowEvent


         EventPhaseContext phaseContext = new EventPhaseContext(controller, context, log);

         // Feed session it with the events that may have been produced
         for (UpdateNavigationalStateResponse.Event portletEvent : updateResponse.getEvents())
         {
            if (!phaseContext.push(new WindowEvent(portletEvent.getName(), portletEvent.getPayload(), portletRequest.getWindowId())))
            {
               return new PageUpdateResponse(updateResponse, requestProperties, pageNavigationalState, PortletResponse.INTERRUPTED);
            }
         }

         // Deliver events
         while (phaseContext.hasNext())
         {
            WindowEvent toConsumeEvent = phaseContext.next();

            // Apply consumed event quota if necessary
            int consumedEventThreshold = controller.getConsumedEventThreshold();
            if (consumedEventThreshold >= 0)
            {
               if (phaseContext.consumedEventSize + 1 > consumedEventThreshold)
               {
                  log.trace("Event distribution interrupted because the maximum number of consumed event is reached");
                  safeInvoker.eventDiscarded(eventCC, phaseContext, toConsumeEvent, EventControllerContext.CONSUMED_EVENT_FLOODED);
                  return new PageUpdateResponse(updateResponse, requestProperties, pageNavigationalState, PortletResponse.INTERRUPTED);
               }
            }

            //
            PortletInvocationResponse eventResponse;
            try
            {
               eventResponse = deliverEvent(context, toConsumeEvent, pageNavigationalState, requestProperties.getCookies());
            }
            catch (Exception e)
            {
               log.trace("Event delivery of " + toConsumeEvent + " failed", e);
               safeInvoker.eventFailed(eventCC, phaseContext, toConsumeEvent, e);
               continue;
            }

            // Now it is consumed
            phaseContext.consumedEventSize++;

            // Update nav state if needed
            if (eventResponse instanceof UpdateNavigationalStateResponse)
            {
               UpdateNavigationalStateResponse eventStateResponse = (UpdateNavigationalStateResponse)eventResponse;

               // Update ns
               updateNavigationalState(context, toConsumeEvent.getWindowId(), eventStateResponse, pageNavigationalState);

               // Add events to source event queue
               for (UpdateNavigationalStateResponse.Event portletEvent : eventStateResponse.getEvents())
               {
                  WindowEvent toRouteEvent = new WindowEvent(portletEvent.getName(), portletEvent.getPayload(), toConsumeEvent.getWindowId());

                  //
                  if (!phaseContext.push(toConsumeEvent,  toRouteEvent))
                  {
                     return new PageUpdateResponse(updateResponse, requestProperties, pageNavigationalState, PortletResponse.INTERRUPTED);
View Full Code Here


   @Override
   public boolean hasNext()
   {
      while (next == null && toConsumeEvents.size() > 0)
      {
         WindowEvent toConsumeEvent = toConsumeEvents.removeFirst();
         String consumedId = toConsumeEvent.getWindowId();

         //
         PortletInfo consumerPortletInfo = context.getPortletInfo(consumedId);
         if (consumerPortletInfo == null)
         {
            log.trace("Cannot deliver event " + toConsumeEvent +" because the consumer of the event does not have a portlet info");
            safeInvoker.eventDiscarded(context.getEventControllerContext(), this, toConsumeEvent, EventControllerContext.EVENT_CONSUMER_INFO_NOT_AVAILABLE);
            continue;
         }

         //
         if (!controller.getDistributeNonConsumableEvents())
         {
            if (!consumerPortletInfo.getEventing().getConsumedEvents().containsKey(toConsumeEvent.getName()))
            {
               log.trace("Cannot deliver event " + toConsumeEvent +" because the consumer of the event does not accept the event name");
               safeInvoker.eventDiscarded(context.getEventControllerContext(), this, toConsumeEvent, EventControllerContext.PORTLET_DOES_NOT_CONSUME_EVENT);
               continue;
            }
View Full Code Here

   {
      if (!hasNext())
      {
         throw new NoSuchElementException();
      }
      WindowEvent tmp = next;
      next = null;
      return tmp;
   }
View Full Code Here

         for (Portlet portlet : invoker.getPortlets())
         {
            PortletInfo portletInfo = portlet.getInfo();
            if (portletInfo.getEventing().getConsumedEvents().containsKey(producedEvent.getName()))
            {
               WindowEvent distributedEvent = new WindowEvent(producedEvent.getName(), producedEvent.getPayload(), portlet.getContext().getId());
               toConsume.addLast(distributedEvent);
            }
         }
         return toConsume;
      }
View Full Code Here

TOP

Related Classes of org.gatein.pc.controller.event.WindowEvent

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.