Author: ghjboss
Date: 2011-10-24 12:15:13 -0400 (Mon, 24 Oct 2011)
New Revision: 7852
Modified:
epp/portal/branches/EPP_5_1_1_GA_JBEPP-1284/component/identity/src/main/java/org/exoplatform/services/organization/idm/IntegrationCache.java
epp/portal/branches/EPP_5_1_1_GA_JBEPP-1284/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMServiceImpl.java
epp/portal/branches/EPP_5_1_1_GA_JBEPP-1284/web/portal/src/main/webapp/WEB-INF/conf/organization/idm-configuration.xml
Log:
fix for JBEPP-1284
Modified:
epp/portal/branches/EPP_5_1_1_GA_JBEPP-1284/component/identity/src/main/java/org/exoplatform/services/organization/idm/IntegrationCache.java
===================================================================
---
epp/portal/branches/EPP_5_1_1_GA_JBEPP-1284/component/identity/src/main/java/org/exoplatform/services/organization/idm/IntegrationCache.java 2011-10-24
14:03:23 UTC (rev 7851)
+++
epp/portal/branches/EPP_5_1_1_GA_JBEPP-1284/component/identity/src/main/java/org/exoplatform/services/organization/idm/IntegrationCache.java 2011-10-24
16:15:13 UTC (rev 7852)
@@ -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,7 +157,8 @@
if (ioNode != null)
{
ioNode.put(NODE_OBJECT_KEY, id);
-
+ setExpiration(ioNode);
+
if (log.isLoggable(Level.FINER))
{
@@ -205,8 +211,9 @@
if (ioNode != null)
{
- ioNode.put(NODE_OBJECT_KEY, rootGroup);
-
+ setExpiration(ioNode);
+ ioNode.put(NODE_OBJECT_KEY, rootGroup);
+
if (log.isLoggable(Level.FINER))
{
@@ -241,5 +248,24 @@
return null;
}
+
+ 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:
epp/portal/branches/EPP_5_1_1_GA_JBEPP-1284/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMServiceImpl.java
===================================================================
---
epp/portal/branches/EPP_5_1_1_GA_JBEPP-1284/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMServiceImpl.java 2011-10-24
14:03:23 UTC (rev 7851)
+++
epp/portal/branches/EPP_5_1_1_GA_JBEPP-1284/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMServiceImpl.java 2011-10-24
16:15:13 UTC (rev 7852)
@@ -70,6 +70,8 @@
public static final String CACHE_CONFIG_STORE_OPTION = "storeCacheConfig";
+ public static final String CACHE_EXPIRATION = "cacheExpiration";
+
private IdentitySessionFactory identitySessionFactory;
private String config;
@@ -96,6 +98,7 @@
ValueParam realmName = initParams.getValueParam(REALM_NAME_OPTION);
ValueParam apiCacheConfig = initParams.getValueParam(CACHE_CONFIG_API_OPTION);
ValueParam storeCacheConfig = initParams.getValueParam(CACHE_CONFIG_STORE_OPTION);
+ ValueParam cacheExpirationParam = initParams.getValueParam(CACHE_EXPIRATION);
if (config == null && jndiName == null)
{
@@ -125,7 +128,16 @@
identityConfiguration = new IdentityConfigurationImpl().configure(configMD);
identityConfiguration.getIdentityConfigurationRegistry().register(hibernateService.getSessionFactory(),
"hibernateSessionFactory");
+
+ int expiration = -1;
+ if (cacheExpirationParam != null &&
+ cacheExpirationParam.getValue() != null &&
+ cacheExpirationParam.getValue().length() > 0)
+ {
+ expiration = Integer.decode(cacheExpirationParam.getValue());
+ }
+
if (apiCacheConfig != null)
{
InputStream configStream =
confManager.getInputStream(apiCacheConfig.getValue());
@@ -147,12 +159,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(integrationCache);
@@ -162,6 +176,7 @@
InputStream configStream =
confManager.getInputStream(storeCacheConfig.getValue());
JBossCacheIdentityStoreCacheProviderImpl storeCacheProvider = new
JBossCacheIdentityStoreCacheProviderImpl();
+ storeCacheProvider.setExpiration(expiration);
storeCacheProvider.initialize(configStream);
picketLinkIDMCache.register(storeCacheProvider);
identityConfiguration.getIdentityConfigurationRegistry().register(storeCacheProvider,
"storeCacheProvider");
Modified:
epp/portal/branches/EPP_5_1_1_GA_JBEPP-1284/web/portal/src/main/webapp/WEB-INF/conf/organization/idm-configuration.xml
===================================================================
---
epp/portal/branches/EPP_5_1_1_GA_JBEPP-1284/web/portal/src/main/webapp/WEB-INF/conf/organization/idm-configuration.xml 2011-10-24
14:03:23 UTC (rev 7851)
+++
epp/portal/branches/EPP_5_1_1_GA_JBEPP-1284/web/portal/src/main/webapp/WEB-INF/conf/organization/idm-configuration.xml 2011-10-24
16:15:13 UTC (rev 7852)
@@ -155,6 +155,10 @@
<value>true</value>
</value-param>
+ <value-param>
+ <name>cacheExpiration</name>
+ <value>1800000</value>
+ </value-param>
</init-params>
</component>
Show replies by date