[gatein-commits] gatein SVN: r7539 - in portal/trunk: component/pc/src/main/java/org/exoplatform/portal/pc and 3 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Sep 27 13:34:56 EDT 2011


Author: chris.laprun at jboss.com
Date: 2011-09-27 13:34:56 -0400 (Tue, 27 Sep 2011)
New Revision: 7539

Modified:
   portal/trunk/component/pc/src/main/java/org/exoplatform/portal/pc/ExoKernelIntegration.java
   portal/trunk/pom.xml
   portal/trunk/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/WSRPServiceIntegration.java
   portal/trunk/wsrp-integration/extension-component/src/main/resources/conf/wsrp-consumers-config.xml
   portal/trunk/wsrp-integration/extension-config/src/main/resources/conf/configuration.xml
Log:
- Only use one FederatingPortletInvoker instance instead of having one per portal container so that WSRP can work in clustered environments.
- Updated to use WSRP 2.1.0-Beta06 and changes to PC 2.3.0-Beta06.


Modified: portal/trunk/component/pc/src/main/java/org/exoplatform/portal/pc/ExoKernelIntegration.java
===================================================================
--- portal/trunk/component/pc/src/main/java/org/exoplatform/portal/pc/ExoKernelIntegration.java	2011-09-27 17:02:31 UTC (rev 7538)
+++ portal/trunk/component/pc/src/main/java/org/exoplatform/portal/pc/ExoKernelIntegration.java	2011-09-27 17:34:56 UTC (rev 7539)
@@ -27,6 +27,7 @@
 import org.gatein.common.logging.LoggerFactory;
 import org.gatein.pc.api.PortletInvoker;
 import org.gatein.pc.bridge.BridgeInterceptor;
+import org.gatein.pc.federation.FederatedPortletInvoker;
 import org.gatein.pc.federation.FederatingPortletInvoker;
 import org.gatein.pc.federation.impl.FederatingPortletInvokerService;
 import org.gatein.pc.portlet.PortletInvokerInterceptor;
@@ -91,7 +92,7 @@
       portletApplicationRegistry = new ExoPortletApplicationDeployer();
       portletApplicationRegistry.setContainerPortletInvoker(containerPortletInvoker);
 
-      //
+      // activate schema validation for portlet.xml if needed
       String validation = PropertyManager.getProperty("gatein.portlet.validation");
       boolean validated = validation == null || "true".equals(validation.trim().toLowerCase());
       log.debug("portlet xml validation is " + (validated ? "enabled" : " disabled"));
@@ -100,9 +101,15 @@
       //Container Stack
       ContainerPortletDispatcher portletContainerDispatcher = new ContainerPortletDispatcher();
       
-      // Federating portlet invoker
-      FederatingPortletInvoker federatingPortletInvoker = new FederatingPortletInvokerService();
-      
+      // 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 =
@@ -141,17 +148,21 @@
       producerStateManagementPolicy.setPersistLocally(false);
 
       // The producer state converter
-      StateConverter producerStateConverter = new ExoStateConverter();//StateConverterV0();
+      StateConverter producerStateConverter = new ExoStateConverter();
 
       // The producer portlet invoker
       ProducerPortletInvoker producerPortletInvoker = new ProducerPortletInvoker();
       producerPortletInvoker.setNext(containerPortletInvoker);
-      federatingPortletInvoker.registerInvoker(PortletInvoker.LOCAL_PORTLET_INVOKER_ID, producerPortletInvoker);
-
       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);

Modified: portal/trunk/pom.xml
===================================================================
--- portal/trunk/pom.xml	2011-09-27 17:02:31 UTC (rev 7538)
+++ portal/trunk/pom.xml	2011-09-27 17:34:56 UTC (rev 7539)
@@ -47,7 +47,7 @@
       <org.gatein.wci.version>2.1.0-Beta06</org.gatein.wci.version>
       <org.gatein.pc.version>2.3.0-Beta06</org.gatein.pc.version>
       <org.picketlink.idm>1.3.0.Alpha04</org.picketlink.idm>
-      <org.gatein.wsrp.version>2.1.0-Beta05</org.gatein.wsrp.version>
+      <org.gatein.wsrp.version>2.1.0-Beta06</org.gatein.wsrp.version>
       <org.gatein.mop.version>1.1.0-Beta06</org.gatein.mop.version>
       <org.gatein.mgmt.version>1.0.0-Beta03</org.gatein.mgmt.version>
       <org.slf4j.version>1.5.8</org.slf4j.version>

Modified: portal/trunk/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/WSRPServiceIntegration.java
===================================================================
--- portal/trunk/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/WSRPServiceIntegration.java	2011-09-27 17:02:31 UTC (rev 7538)
+++ portal/trunk/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/WSRPServiceIntegration.java	2011-09-27 17:34:56 UTC (rev 7539)
@@ -30,6 +30,7 @@
 import org.exoplatform.portal.config.DataStorage;
 import org.exoplatform.portal.pc.ExoKernelIntegration;
 import org.exoplatform.portal.pom.config.POMSessionManager;
+import org.exoplatform.services.cache.CacheService;
 import org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator;
 import org.exoplatform.services.listener.ListenerService;
 import org.gatein.common.logging.Logger;
@@ -40,6 +41,7 @@
 import org.gatein.integration.wsrp.structure.PortalStructureAccess;
 import org.gatein.pc.api.PortletInvoker;
 import org.gatein.pc.federation.FederatingPortletInvoker;
+import org.gatein.pc.federation.PortletInvokerResolver;
 import org.gatein.pc.portlet.PortletInvokerInterceptor;
 import org.gatein.pc.portlet.aspects.EventPayloadInterceptor;
 import org.gatein.pc.portlet.container.ContainerPortletInvoker;
@@ -61,9 +63,9 @@
 import org.gatein.wsrp.WSRPConstants;
 import org.gatein.wsrp.consumer.migration.JCRMigrationService;
 import org.gatein.wsrp.consumer.migration.MigrationService;
-import org.gatein.wsrp.consumer.registry.ActivatingNullInvokerHandler;
 import org.gatein.wsrp.consumer.registry.ConsumerRegistry;
 import org.gatein.wsrp.consumer.registry.JCRConsumerRegistry;
+import org.gatein.wsrp.consumer.registry.RegisteringPortletInvokerResolver;
 import org.gatein.wsrp.payload.WSRPEventPayloadInterceptor;
 import org.gatein.wsrp.producer.ProducerHolder;
 import org.gatein.wsrp.producer.WSRPProducer;
@@ -184,6 +186,7 @@
       }
       catch (Exception e)
       {
+         log.debug("Couldn't load WSRP producer configuration from " + producerConfigLocation, e);
          throw new RuntimeException("Couldn't load WSRP producer configuration from " + producerConfigLocation, e);
       }
       container.registerComponentInstance(ProducerConfigurationService.class, producerConfigurationService);
@@ -198,6 +201,7 @@
       }
       catch (Exception e)
       {
+         log.debug("Couldn't instantiate RegistrationPersistenceManager", e);
          throw new RuntimeException("Couldn't instantiate RegistrationPersistenceManager", e);
       }
       RegistrationManager registrationManager = new RegistrationManagerImpl();
@@ -251,6 +255,7 @@
       }
       catch (Exception e)
       {
+         log.debug("Couldn't instantiate PortletStatePersistenceManager", e);
          throw new RuntimeException("Couldn't instantiate PortletStatePersistenceManager", e);
       }
 
@@ -309,6 +314,14 @@
          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);
@@ -327,13 +340,14 @@
 
          consumerRegistry.start();
 
-         // set up a NullInvokerHandler so that when a remote producer is queried, we can start it if needed
-         ActivatingNullInvokerHandler handler = new ActivatingNullInvokerHandler();
-         handler.setConsumerRegistry(consumerRegistry);
-         federatingPortletInvoker.setNullInvokerHandler(handler);
+         // 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);
       }
       container.registerComponentInstance(ConsumerRegistry.class, consumerRegistry);
@@ -370,6 +384,7 @@
       }
       catch (Exception e)
       {
+         log.debug(e);
          throw new RuntimeException("Couldn't stop WSRP consumers registry.", e);
       }
 

Modified: portal/trunk/wsrp-integration/extension-component/src/main/resources/conf/wsrp-consumers-config.xml
===================================================================
--- portal/trunk/wsrp-integration/extension-component/src/main/resources/conf/wsrp-consumers-config.xml	2011-09-27 17:02:31 UTC (rev 7538)
+++ portal/trunk/wsrp-integration/extension-component/src/main/resources/conf/wsrp-consumers-config.xml	2011-09-27 17:34:56 UTC (rev 7539)
@@ -25,7 +25,7 @@
 
 <deployments xmlns="http://www.gatein.org/xml/ns/gatein_wsrp_consumer_1_0"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-             xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_wsrp_consumer_1_0 http://www.jboss.org/portal/xsd/gatein_wsrp_consumer_1_0.xsd">
+             xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_wsrp_consumer_1_0 http://www.gatein.org/xml/ns/gatein_wsrp_consumer_1_0.xsd">
    <deployment>
       <wsrp-producer id="selfv1" expiration-cache="500" ws-timeout="50000">
          <endpoint-wsdl-url>http://localhost:8080/wsrp-producer/v1/MarkupService?wsdl</endpoint-wsdl-url>

Modified: portal/trunk/wsrp-integration/extension-config/src/main/resources/conf/configuration.xml
===================================================================
--- portal/trunk/wsrp-integration/extension-config/src/main/resources/conf/configuration.xml	2011-09-27 17:02:31 UTC (rev 7538)
+++ portal/trunk/wsrp-integration/extension-config/src/main/resources/conf/configuration.xml	2011-09-27 17:34:56 UTC (rev 7539)
@@ -56,4 +56,33 @@
          </init-params>
       </component-plugin>
    </external-component-plugins>
+
+   <!-- Cache configuration in clustered mode for ConsumerRegistry -->
+   <!--<external-component-plugins>
+      <target-component>org.exoplatform.services.cache.CacheService</target-component>
+      <component-plugin profiles="cluster">
+         <name>addExoCacheConfig</name>
+         <set-method>addExoCacheConfig</set-method>
+         <type>org.exoplatform.services.cache.ExoCacheConfigPlugin</type>
+         <description>add Exo Cache Config</description>
+         <init-params>
+            <object-param>
+               <name>cache.config.DistributedConsumerCache</name>
+               <description>The JBoss Cache configuration for the ConsumerRegistry distributed consumer cache
+               </description>
+               <object type="org.exoplatform.services.cache.ExoCacheConfig">
+                  <field name="name">
+                     <string>DistributedConsumerCache</string>
+                  </field>
+                  <field name="liveTime">
+                     <long>600</long>
+                  </field>
+                  <field name="distributed">
+                     <boolean>true</boolean>
+                  </field>
+               </object>
+            </object-param>
+         </init-params>
+      </component-plugin>
+   </external-component-plugins>-->
 </configuration>
\ No newline at end of file



More information about the gatein-commits mailing list