Examples of FederatingPortletInvoker


Examples of org.gatein.pc.federation.FederatingPortletInvoker

        portletApplicationRegistry.setSchemaValidated(validated);

        // Container Stack
        ContainerPortletDispatcher portletContainerDispatcher = new ContainerPortletDispatcher();

        FederatingPortletInvoker federatingPortletInvoker = new FederatingPortletInvokerService();

        EventPayloadInterceptor eventPayloadInterceptor = new EventPayloadInterceptor();
        eventPayloadInterceptor.setNext(portletContainerDispatcher);
        RequestAttributeConversationInterceptor requestAttributeConversationInterceptor = new RequestAttributeConversationInterceptor();
        requestAttributeConversationInterceptor.setNext(eventPayloadInterceptor);
        CCPPInterceptor ccppInterceptor = new CCPPInterceptor();
        ccppInterceptor.setNext(requestAttributeConversationInterceptor);
        BridgeInterceptor bridgepInterceptor = new BridgeInterceptor();
        bridgepInterceptor.setNext(ccppInterceptor);
        ProducerCacheInterceptor producerCacheInterceptor = new ProducerCacheInterceptor();
        producerCacheInterceptor.setNext(bridgepInterceptor);
        SessionInvalidatorInterceptor sessionInvalidatorInterceptor = new SessionInvalidatorInterceptor();
        sessionInvalidatorInterceptor.setNext(producerCacheInterceptor);
        ContextDispatcherInterceptor contextDispatcherInterceptor = new ContextDispatcherInterceptor();
        contextDispatcherInterceptor.setNext(sessionInvalidatorInterceptor);
        PortletLifecyclePhaseInterceptor portletLifecyclePhaseInterceptor = new PortletLifecyclePhaseInterceptor();
        portletLifecyclePhaseInterceptor.setNext(contextDispatcherInterceptor);
        SecureTransportInterceptor secureTransportInterceptor = new SecureTransportInterceptor();
        secureTransportInterceptor.setNext(portletLifecyclePhaseInterceptor);
        ValveInterceptor valveInterceptor = new ValveInterceptor();
        valveInterceptor.setPortletApplicationRegistry(portletApplicationRegistry);
        valveInterceptor.setNext(secureTransportInterceptor);

        // The portlet container invoker continued
        containerPortletInvoker.setNext(valveInterceptor);

        // register container invoker so that WSRP can use it, WSRP uses its own ProducerPortletInvoker
        container.registerComponentInstance(ContainerPortletInvoker.class, containerPortletInvoker);

        // The producer persistence manager
        PortletStatePersistenceManagerService producerPersistenceManager = new PortletStatePersistenceManagerService();

        // The producer state management policy
        StateManagementPolicyService producerStateManagementPolicy = new StateManagementPolicyService();
        producerStateManagementPolicy.setPersistLocally(false);

        // The producer state converter
        StateConverter producerStateConverter = new ExoStateConverter();

        // The producer portlet invoker
        ProducerPortletInvoker producerPortletInvoker = new ProducerPortletInvoker();
        producerPortletInvoker.setNext(containerPortletInvoker);
        producerPortletInvoker.setPersistenceManager(producerPersistenceManager);
        producerPortletInvoker.setStateManagementPolicy(producerStateManagementPolicy);
        producerPortletInvoker.setStateConverter(producerStateConverter);

        // 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
        PortletCustomizationInterceptor portletCustomizationInterceptor = new PortletCustomizationInterceptor();
View Full Code Here

Examples of org.gatein.pc.federation.FederatingPortletInvoker

           // 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);
        }
    }
View Full Code Here

Examples of org.gatein.pc.federation.FederatingPortletInvoker

{
   private transient ConsumerRegistrySPI consumerRegistry;

   public FederatedPortletInvoker resolvePortletInvokerFor(String invokerId, FederatingPortletInvoker callingInvoker, String compoundPortletId) throws NoSuchPortletException
   {
      FederatingPortletInvoker registryInvoker = consumerRegistry.getFederatingPortletInvoker();
      if (!registryInvoker.equals(callingInvoker))
      {
         throw new IllegalArgumentException("Trying to use a ConsumerRegistry already linked to a different FederatingPortletInvoker ("
            + registryInvoker + ") than the specified one (" + callingInvoker + ")");
      }
View Full Code Here

Examples of org.gatein.pc.federation.FederatingPortletInvoker

      consumerCacheInterceptor.setNext(portletCustomizationInterceptor);
      PortletInvokerInterceptor consumerPortletInvoker = new PortletInvokerInterceptor();
      consumerPortletInvoker.setNext(consumerCacheInterceptor);

      // Federating portlet invoker
      FederatingPortletInvoker federatingPortletInvoker = new FederatingPortletInvokerService();

      // register local portlet invoker with federating portlet invoker
      federatingPortletInvoker.registerInvoker(PortletInvoker.LOCAL_PORTLET_INVOKER_ID, consumerPortletInvoker);
      // register federating portlet invoker with container
      container.registerComponentInstance(PortletInvoker.class, federatingPortletInvoker);

      portletApplicationRegistry.start();
   }
View Full Code Here

Examples of org.gatein.pc.federation.FederatingPortletInvoker

        // Container Stack
        ContainerPortletDispatcher portletContainerDispatcher = new ContainerPortletDispatcher();

        // Check if we already have a federating portlet invoker
        final ExoContainer topContainer = ExoContainerContext.getTopContainer();
        FederatingPortletInvoker federatingPortletInvoker = (FederatingPortletInvoker) topContainer
                .getComponentInstanceOfType(FederatingPortletInvoker.class);
        if (federatingPortletInvoker == null) {
            federatingPortletInvoker = new FederatingPortletInvokerService();
            topContainer.registerComponentInstance(FederatingPortletInvoker.class, federatingPortletInvoker);
        }

        EventPayloadInterceptor eventPayloadInterceptor = new EventPayloadInterceptor();
        eventPayloadInterceptor.setNext(portletContainerDispatcher);
        RequestAttributeConversationInterceptor requestAttributeConversationInterceptor = new RequestAttributeConversationInterceptor();
        requestAttributeConversationInterceptor.setNext(eventPayloadInterceptor);
        CCPPInterceptor ccppInterceptor = new CCPPInterceptor();
        ccppInterceptor.setNext(requestAttributeConversationInterceptor);
        BridgeInterceptor bridgepInterceptor = new BridgeInterceptor();
        bridgepInterceptor.setNext(ccppInterceptor);
        ProducerCacheInterceptor producerCacheInterceptor = new ProducerCacheInterceptor();
        producerCacheInterceptor.setNext(bridgepInterceptor);
        SessionInvalidatorInterceptor sessionInvalidatorInterceptor = new SessionInvalidatorInterceptor();
        sessionInvalidatorInterceptor.setNext(producerCacheInterceptor);
        ContextDispatcherInterceptor contextDispatcherInterceptor = new ContextDispatcherInterceptor();
        contextDispatcherInterceptor.setNext(sessionInvalidatorInterceptor);
        SecureTransportInterceptor secureTransportInterceptor = new SecureTransportInterceptor();
        secureTransportInterceptor.setNext(contextDispatcherInterceptor);
        ValveInterceptor valveInterceptor = new ValveInterceptor();
        valveInterceptor.setPortletApplicationRegistry(portletApplicationRegistry);
        valveInterceptor.setNext(secureTransportInterceptor);

        // The portlet container invoker continued
        containerPortletInvoker.setNext(valveInterceptor);

        // register container invoker so that WSRP can use it, WSRP uses its own ProducerPortletInvoker
        container.registerComponentInstance(ContainerPortletInvoker.class, containerPortletInvoker);

        // The producer persistence manager
        PortletStatePersistenceManagerService producerPersistenceManager = new PortletStatePersistenceManagerService();

        // The producer state management policy
        StateManagementPolicyService producerStateManagementPolicy = new StateManagementPolicyService();
        producerStateManagementPolicy.setPersistLocally(false);

        // The producer state converter
        StateConverter producerStateConverter = new ExoStateConverter();

        // The producer portlet invoker
        ProducerPortletInvoker producerPortletInvoker = new ProducerPortletInvoker();
        producerPortletInvoker.setNext(containerPortletInvoker);
        producerPortletInvoker.setPersistenceManager(producerPersistenceManager);
        producerPortletInvoker.setStateManagementPolicy(producerStateManagementPolicy);
        producerPortletInvoker.setStateConverter(producerStateConverter);

        // 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
        PortletCustomizationInterceptor portletCustomizationInterceptor = new PortletCustomizationInterceptor();
View Full Code Here

Examples of org.gatein.pc.federation.FederatingPortletInvoker

           // 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);
        }
    }
View Full Code Here

Examples of org.gatein.pc.federation.FederatingPortletInvoker

{
   private transient ConsumerRegistry consumerRegistry;

   public FederatedPortletInvoker resolvePortletInvokerFor(String compoundPortletId, String invokerId, FederatingPortletInvoker callingInvoker) throws NoSuchPortletException
   {
      FederatingPortletInvoker registryInvoker = consumerRegistry.getFederatingPortletInvoker();
      if (registryInvoker != callingInvoker)
      {
         throw new IllegalArgumentException("Trying to use a ConsumerRegistry already linked to a different FederatingPortletInvoker ("
            + registryInvoker + ") than the specified one (" + callingInvoker + ")");
      }
View Full Code Here

Examples of org.gatein.pc.federation.FederatingPortletInvoker

        log.info("WSRP Producer started");
    }

    private void startConsumers() {
        // retrieve federating portlet invoker from container
        FederatingPortletInvoker federatingPortletInvoker = (FederatingPortletInvoker) container
                .getComponentInstanceOfType(FederatingPortletInvoker.class);

        // add our Session event listener to the ListenerService for use in org.exoplatform.web.GenericHttpListener
        ListenerService listenerService = (ListenerService) container.getComponentInstanceOfType(ListenerService.class);
        SessionEventListenerAndBroadcaster sessionEventBroadcaster = new SessionEventListenerAndBroadcaster();

        // events from org.exoplatform.web.GenericHttpListener
        listenerService.addListener("org.exoplatform.web.GenericHttpListener.sessionCreated", sessionEventBroadcaster);
        listenerService.addListener("org.exoplatform.web.GenericHttpListener.sessionDestroyed", sessionEventBroadcaster);

        try {
            JCRPersister persister = new JCRPersister(container, JCRPersister.WSRP_WORKSPACE_NAME);
            persister.initializeBuilderFor(JCRConsumerRegistry.mappingClasses);

            consumerRegistry = new JCRConsumerRegistry(persister);
            consumerRegistry.setFederatingPortletInvoker(federatingPortletInvoker);
            consumerRegistry.setSessionEventBroadcaster(sessionEventBroadcaster);
            consumerRegistry.setConfigurationIS(consumersConfigurationIS);

            // if we run in a cluster, use a distributed cache for consumers
            /*
             * if (ExoContainer.getProfiles().contains("cluster")) { CacheService cacheService =
             * (CacheService)container.getComponentInstanceOfType(CacheService.class); DistributedConsumerCache consumerCache =
             * new DistributedConsumerCache(cacheService); consumerRegistry.setConsumerCache(consumerCache); }
             */

            // create ConsumerStructureProvider and register it to listen to page events
            POMSessionManager sessionManager = (POMSessionManager) container
                    .getComponentInstanceOfType(POMSessionManager.class);
            PortalStructureAccess structureAccess = new MOPPortalStructureAccess(sessionManager);
            MOPConsumerStructureProvider structureprovider = new MOPConsumerStructureProvider(structureAccess);
            listenerService.addListener(EventType.PAGE_CREATED, structureprovider);
            listenerService.addListener(EventType.PAGE_DESTROYED, structureprovider);
            listenerService.addListener(EventType.PAGE_UPDATED, structureprovider);
            listenerService.addListener(DataStorage.PAGE_UPDATED, structureprovider);

            // migration service
            persister = new JCRPersister(container, JCRPersister.WSRP_WORKSPACE_NAME);
            persister.initializeBuilderFor(JCRMigrationService.mappingClasses);

            MigrationService migrationService = new JCRMigrationService(persister);
            migrationService.setStructureProvider(structureprovider);
            consumerRegistry.setMigrationService(migrationService);

            // wait 'delay' seconds before starting the consumers to give JBoss WS a chance to publish the WSDL and not deadlock
            ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(1);
            scheduledExecutorService.schedule(new Runnable() {
                public void run() {
                    try {
                        consumerRegistry.start();
                    } catch (Exception e) {
                        throw new RuntimeException(e);
                    }
                }
            }, consumersInitDelay, TimeUnit.SECONDS);

            // set up a PortletInvokerResolver so that when a remote producer is queried, we can start it if needed
            RegisteringPortletInvokerResolver resolver = new RegisteringPortletInvokerResolver();
            resolver.setConsumerRegistry(consumerRegistry);
            federatingPortletInvoker.setPortletInvokerResolver(resolver);
        } catch (Exception e) {
            log.debug(e);
            throw new RuntimeException("Couldn't start WSRP consumers registry from configuration " + consumersConfigLocation,
                    e);
        }
View Full Code Here

Examples of org.gatein.pc.federation.FederatingPortletInvoker

        // Container Stack
        ContainerPortletDispatcher portletContainerDispatcher = new ContainerPortletDispatcher();

        // Check if we already have a federating portlet invoker
        final ExoContainer topContainer = ExoContainerContext.getTopContainer();
        FederatingPortletInvoker federatingPortletInvoker = (FederatingPortletInvoker) topContainer
                .getComponentInstanceOfType(FederatingPortletInvoker.class);
        if (federatingPortletInvoker == null) {
            federatingPortletInvoker = new FederatingPortletInvokerService();
            topContainer.registerComponentInstance(FederatingPortletInvoker.class, federatingPortletInvoker);
        }

        EventPayloadInterceptor eventPayloadInterceptor = new EventPayloadInterceptor();
        eventPayloadInterceptor.setNext(portletContainerDispatcher);
        RequestAttributeConversationInterceptor requestAttributeConversationInterceptor = new RequestAttributeConversationInterceptor();
        requestAttributeConversationInterceptor.setNext(eventPayloadInterceptor);
        CCPPInterceptor ccppInterceptor = new CCPPInterceptor();
        ccppInterceptor.setNext(requestAttributeConversationInterceptor);
        BridgeInterceptor bridgepInterceptor = new BridgeInterceptor();
        bridgepInterceptor.setNext(ccppInterceptor);
        ProducerCacheInterceptor producerCacheInterceptor = new ProducerCacheInterceptor();
        producerCacheInterceptor.setNext(bridgepInterceptor);
        SessionInvalidatorInterceptor sessionInvalidatorInterceptor = new SessionInvalidatorInterceptor();
        sessionInvalidatorInterceptor.setNext(producerCacheInterceptor);
        ContextDispatcherInterceptor contextDispatcherInterceptor = new ContextDispatcherInterceptor();
        contextDispatcherInterceptor.setNext(sessionInvalidatorInterceptor);
        SecureTransportInterceptor secureTransportInterceptor = new SecureTransportInterceptor();
        secureTransportInterceptor.setNext(contextDispatcherInterceptor);
        ValveInterceptor valveInterceptor = new ValveInterceptor();
        valveInterceptor.setPortletApplicationRegistry(portletApplicationRegistry);
        valveInterceptor.setNext(secureTransportInterceptor);

        // The portlet container invoker continued
        containerPortletInvoker.setNext(valveInterceptor);

        // register container invoker so that WSRP can use it, WSRP uses its own ProducerPortletInvoker
        container.registerComponentInstance(ContainerPortletInvoker.class, containerPortletInvoker);

        // The producer persistence manager
        PortletStatePersistenceManagerService producerPersistenceManager = new PortletStatePersistenceManagerService();

        // The producer state management policy
        StateManagementPolicyService producerStateManagementPolicy = new StateManagementPolicyService();
        producerStateManagementPolicy.setPersistLocally(false);

        // The producer state converter
        StateConverter producerStateConverter = new ExoStateConverter();

        // The producer portlet invoker
        ProducerPortletInvoker producerPortletInvoker = new ProducerPortletInvoker();
        producerPortletInvoker.setNext(containerPortletInvoker);
        producerPortletInvoker.setPersistenceManager(producerPersistenceManager);
        producerPortletInvoker.setStateManagementPolicy(producerStateManagementPolicy);
        producerPortletInvoker.setStateConverter(producerStateConverter);

        // 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);
        }

        // The consumer portlet invoker
        PortletCustomizationInterceptor portletCustomizationInterceptor = new PortletCustomizationInterceptor();
        portletCustomizationInterceptor.setNext(federatingPortletInvoker);
View Full Code Here

Examples of org.gatein.pc.federation.FederatingPortletInvoker

        log.info("WSRP Producer started");
    }

    private void startConsumers() {
        // retrieve federating portlet invoker from container
        FederatingPortletInvoker federatingPortletInvoker = (FederatingPortletInvoker) container
                .getComponentInstanceOfType(FederatingPortletInvoker.class);

        // add our Session event listener to the ListenerService for use in org.exoplatform.web.GenericHttpListener
        ListenerService listenerService = (ListenerService) container.getComponentInstanceOfType(ListenerService.class);
        SessionEventListenerAndBroadcaster sessionEventBroadcaster = new SessionEventListenerAndBroadcaster();

        // events from org.exoplatform.web.GenericHttpListener
        listenerService.addListener("org.exoplatform.web.GenericHttpListener.sessionCreated", sessionEventBroadcaster);
        listenerService.addListener("org.exoplatform.web.GenericHttpListener.sessionDestroyed", sessionEventBroadcaster);

        try {
            JCRPersister persister = new JCRPersister(container, JCRPersister.WSRP_WORKSPACE_NAME);
            persister.initializeBuilderFor(JCRConsumerRegistry.mappingClasses);

            consumerRegistry = new JCRConsumerRegistry(persister);
            consumerRegistry.setFederatingPortletInvoker(federatingPortletInvoker);
            consumerRegistry.setSessionEventBroadcaster(sessionEventBroadcaster);
            consumerRegistry.setConfigurationIS(consumersConfigurationIS);

            // if we run in a cluster, use a distributed cache for consumers
            /*
             * if (ExoContainer.getProfiles().contains("cluster")) { CacheService cacheService =
             * (CacheService)container.getComponentInstanceOfType(CacheService.class); DistributedConsumerCache consumerCache =
             * new DistributedConsumerCache(cacheService); consumerRegistry.setConsumerCache(consumerCache); }
             */

            // create ConsumerStructureProvider and register it to listen to page events
            POMSessionManager sessionManager = (POMSessionManager) container
                    .getComponentInstanceOfType(POMSessionManager.class);
            PortalStructureAccess structureAccess = new MOPPortalStructureAccess(sessionManager);
            MOPConsumerStructureProvider structureprovider = new MOPConsumerStructureProvider(structureAccess);
            listenerService.addListener(EventType.PAGE_CREATED, structureprovider);
            listenerService.addListener(EventType.PAGE_DESTROYED, structureprovider);
            listenerService.addListener(EventType.PAGE_UPDATED, structureprovider);
            listenerService.addListener(DataStorage.PAGE_UPDATED, structureprovider);

            // migration service
            persister = new JCRPersister(container, JCRPersister.WSRP_WORKSPACE_NAME);
            persister.initializeBuilderFor(JCRMigrationService.mappingClasses);

            MigrationService migrationService = new JCRMigrationService(persister);
            migrationService.setStructureProvider(structureprovider);
            consumerRegistry.setMigrationService(migrationService);

            // wait 'delay' seconds before starting the consumers to give JBoss WS a chance to publish the WSDL and not deadlock
            ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(1);
            scheduledExecutorService.schedule(new Runnable() {
                public void run() {
                    try {
                        consumerRegistry.start();
                    } catch (Exception e) {
                        throw new RuntimeException(e);
                    }
                }
            }, consumersInitDelay, TimeUnit.SECONDS);

            // set up a PortletInvokerResolver so that when a remote producer is queried, we can start it if needed
            RegisteringPortletInvokerResolver resolver = new RegisteringPortletInvokerResolver();
            resolver.setConsumerRegistry(consumerRegistry);
            federatingPortletInvoker.setPortletInvokerResolver(resolver);
        } catch (Exception e) {
            log.debug(e);
            throw new RuntimeException("Couldn't start WSRP consumers registry from configuration " + consumersConfigLocation,
                    e);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.