[gatein-commits] gatein SVN: r6310 - in portal/trunk: component/identity/src/main/java/org/exoplatform/services/organization/idm and 1 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Apr 20 19:04:32 EDT 2011


Author: bdaw
Date: 2011-04-20 19:04:32 -0400 (Wed, 20 Apr 2011)
New Revision: 6310

Modified:
   portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/IntegrationCache.java
   portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMServiceImpl.java
   portal/trunk/pom.xml
   portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/idm-configuration.xml
Log:
GTNPORTAL-1866 - Issue with picketlink cache - cached items are never evicted

Modified: portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/IntegrationCache.java
===================================================================
--- portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/IntegrationCache.java	2011-04-20 20:36:51 UTC (rev 6309)
+++ portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/IntegrationCache.java	2011-04-20 23:04:32 UTC (rev 6310)
@@ -6,6 +6,9 @@
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.Node;
+import org.jboss.cache.eviction.ExpirationAlgorithmConfig;
+import org.jboss.cache.eviction.ExpirationConfiguration;
+
 import org.picketlink.idm.api.Group;
 import org.picketlink.idm.api.User;
 
@@ -55,6 +58,8 @@
 
    public static final String NODE_OBJECT_KEY = "object";
 
+   private int expiration = -1;
+
    private Fqn getRootNode()
    {
       return Fqn.fromString("/" + MAIN_ROOT);
@@ -152,6 +157,7 @@
       if (ioNode != null)
       {
          ioNode.put(NODE_OBJECT_KEY, id);
+         setExpiration(ioNode);
 
          if (log.isLoggable(Level.FINER))
          {
@@ -205,6 +211,7 @@
 
       if (ioNode != null)
       {
+         setExpiration(ioNode);
          ioNode.put(NODE_OBJECT_KEY, rootGroup);
 
          if (log.isLoggable(Level.FINER))
@@ -242,4 +249,22 @@
 
    }
 
+   public void setExpiration(Node node)
+   {
+      if (expiration != -1 && expiration > 0)
+      {
+         Long future = new Long(System.currentTimeMillis() + expiration);
+         node.put(ExpirationAlgorithmConfig.EXPIRATION_KEY, future);
+      }
+   }
+
+   public int getExpiration()
+   {
+      return expiration;
+   }
+
+   public void setExpiration(int expiration)
+   {
+      this.expiration = expiration;
+   }
 }

Modified: portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMServiceImpl.java
===================================================================
--- portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMServiceImpl.java	2011-04-20 20:36:51 UTC (rev 6309)
+++ portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMServiceImpl.java	2011-04-20 23:04:32 UTC (rev 6310)
@@ -76,6 +76,8 @@
 
    public static final String JGROUPS_MUX_ENABLED = "jgroups-multiplexer-stack";
 
+   public static final String CACHE_EXPIRATION = "cacheExpiration";
+
    private IdentitySessionFactory identitySessionFactory;
 
    private String config;
@@ -106,6 +108,7 @@
       ValueParam storeCacheConfig = initParams.getValueParam(CACHE_CONFIG_STORE_OPTION);
       ValueParam jgroupsStack = initParams.getValueParam(JGROUPS_MUX_ENABLED);
       ValueParam jgroupsConfig = initParams.getValueParam(JGROUPS_CONFIG);
+      ValueParam cacheExpirationParam = initParams.getValueParam(CACHE_EXPIRATION);
 
       if (config == null && jndiName == null)
       {
@@ -136,6 +139,13 @@
 
          identityConfiguration.getIdentityConfigurationRegistry().register(hibernateService.getSessionFactory(), "hibernateSessionFactory");
 
+         int expiration = -1;
+
+         if (cacheExpirationParam.getValue() != null && cacheExpirationParam.getValue().length() > 0)
+         {
+            expiration = Integer.decode(cacheExpirationParam.getValue());
+         }
+
          if (apiCacheConfig != null)
          {
 
@@ -159,12 +169,14 @@
 
             // PLIDM API cache
             JBossCacheAPICacheProviderImpl apiCacheProvider = new JBossCacheAPICacheProviderImpl();
+            apiCacheProvider.setExpiration(expiration);
             apiCacheProvider.initialize(cache);
             picketLinkIDMCache.register(apiCacheProvider);
             identityConfiguration.getIdentityConfigurationRegistry().register(apiCacheProvider, "apiCacheProvider");
 
             //Integration cache
             integrationCache = new IntegrationCache();
+            integrationCache.setExpiration(expiration);
             integrationCache.initialize(cache);
             picketLinkIDMCache.register(apiCacheProvider);
 
@@ -192,6 +204,7 @@
             configStream.close();
 
             JBossCacheIdentityStoreCacheProviderImpl storeCacheProvider = new JBossCacheIdentityStoreCacheProviderImpl();
+            storeCacheProvider.setExpiration(expiration);
             storeCacheProvider.initialize(cache);
             picketLinkIDMCache.register(storeCacheProvider);
             identityConfiguration.getIdentityConfigurationRegistry().register(storeCacheProvider, "storeCacheProvider");

Modified: portal/trunk/pom.xml
===================================================================
--- portal/trunk/pom.xml	2011-04-20 20:36:51 UTC (rev 6309)
+++ portal/trunk/pom.xml	2011-04-20 23:04:32 UTC (rev 6310)
@@ -47,7 +47,7 @@
       <org.gatein.common.version>2.0.4-Beta02</org.gatein.common.version>
       <org.gatein.wci.version>2.1.0-Beta02</org.gatein.wci.version>
       <org.gatein.pc.version>2.3.0-Beta02</org.gatein.pc.version>
-      <org.picketlink.idm>1.1.8.GA</org.picketlink.idm>
+      <org.picketlink.idm>1.1.9.CR01</org.picketlink.idm>
       <org.gatein.wsrp.version>2.1.0-Beta02</org.gatein.wsrp.version>
       <org.gatein.mop.version>1.1.0-Beta01</org.gatein.mop.version>
       <org.slf4j.version>1.5.8</org.slf4j.version>

Modified: portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/idm-configuration.xml
===================================================================
--- portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/idm-configuration.xml	2011-04-20 20:36:51 UTC (rev 6309)
+++ portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/idm-configuration.xml	2011-04-20 23:04:32 UTC (rev 6310)
@@ -119,6 +119,12 @@
         <value>true</value>
       </value-param>
 
+      <value-param>
+        <name>cacheExpiration</name>
+        <value>2000</value>
+      </value-param>
+
+
     </init-params>
   </component>
 



More information about the gatein-commits mailing list