Author: thomas.heute(a)jboss.com
Date: 2010-04-29 10:34:27 -0400 (Thu, 29 Apr 2010)
New Revision: 2894
Modified:
portal/branches/EPP_5_0_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMCacheService.java
portal/branches/EPP_5_0_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMServiceImpl.java
portal/branches/EPP_5_0_Branch/pom.xml
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/WEB-INF/conf/organization/idm-configuration.xml
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/examples/picketlink-idm-ldap-acme-config.xml
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/examples/picketlink-idm-ldap-config.xml
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/examples/picketlink-idm-msad-config.xml
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/examples/picketlink-idm-msad-readonly-config.xml
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/examples/picketlink-idm-openldap-acme-config.xml
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/examples/picketlink-idm-openldap-config.xml
Log:
JBEPP-330: Improve caching for LDAP
Modified:
portal/branches/EPP_5_0_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMCacheService.java
===================================================================
---
portal/branches/EPP_5_0_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMCacheService.java 2010-04-29
13:46:58 UTC (rev 2893)
+++
portal/branches/EPP_5_0_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMCacheService.java 2010-04-29
14:34:27 UTC (rev 2894)
@@ -35,6 +35,7 @@
import java.util.List;
import org.picketlink.idm.cache.APICacheProvider;
+import org.picketlink.idm.spi.cache.IdentityStoreCacheProvider;
/*
@@ -50,8 +51,10 @@
public class PicketLinkIDMCacheService
{
- private final List<APICacheProvider> cacheProviders = new
LinkedList<APICacheProvider>();
+ private final List<APICacheProvider> apiCacheProviders = new
LinkedList<APICacheProvider>();
+ private final List<IdentityStoreCacheProvider> storeCacheProviders = new
LinkedList<IdentityStoreCacheProvider>();
+
public PicketLinkIDMCacheService()
{
}
@@ -61,20 +64,36 @@
if (cacheProvider != null)
{
- cacheProviders.add(cacheProvider);
+ apiCacheProviders.add(cacheProvider);
}
}
+ public void register(IdentityStoreCacheProvider cacheProvider)
+ {
+
+ if (cacheProvider != null)
+ {
+ storeCacheProviders.add(cacheProvider);
+ }
+
+ }
+
+
@Managed
@ManagedDescription("Ivalidate cache namespace")
@Impact(ImpactType.WRITE)
public void invalidate(@ManagedDescription("Cache namespace")
@ManagedName("namespace")String namespace)
{
- for (APICacheProvider cacheProvider : cacheProviders)
+ for (APICacheProvider cacheProvider : apiCacheProviders)
{
cacheProvider.invalidate(namespace);
}
+
+ for (IdentityStoreCacheProvider cacheProvider : storeCacheProviders)
+ {
+ cacheProvider.invalidate(namespace);
+ }
}
@Managed
@@ -82,9 +101,14 @@
@Impact(ImpactType.WRITE)
public void invalidateAll()
{
- for (APICacheProvider cacheProvider : cacheProviders)
+ for (APICacheProvider cacheProvider : apiCacheProviders)
{
cacheProvider.invalidateAll();
}
+
+ for (IdentityStoreCacheProvider cacheProvider : storeCacheProviders)
+ {
+ cacheProvider.invalidateAll();
+ }
}
}
Modified:
portal/branches/EPP_5_0_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMServiceImpl.java
===================================================================
---
portal/branches/EPP_5_0_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMServiceImpl.java 2010-04-29
13:46:58 UTC (rev 2893)
+++
portal/branches/EPP_5_0_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMServiceImpl.java 2010-04-29
14:34:27 UTC (rev 2894)
@@ -31,11 +31,13 @@
import org.picketlink.idm.api.cfg.IdentityConfiguration;
import org.picketlink.idm.common.exception.IdentityConfigurationException;
import org.picketlink.idm.impl.cache.JBossCacheAPICacheProviderImpl;
+import org.picketlink.idm.impl.cache.JBossCacheIdentityStoreCacheProviderImpl;
import org.picketlink.idm.impl.configuration.IdentityConfigurationImpl;
import org.picketlink.idm.impl.configuration.jaxb2.JAXB2IdentityConfiguration;
import org.picketlink.idm.spi.configuration.metadata.IdentityConfigurationMetaData;
import org.picocontainer.Startable;
+import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
@@ -61,16 +63,16 @@
public static final String REALM_NAME_OPTION = "portalRealm";
- public static final String CACHE_CONFIG_OPTION = "cacheConfig";
+ public static final String CACHE_CONFIG_API_OPTION = "apiCacheConfig";
+ public static final String CACHE_CONFIG_STORE_OPTION = "storeCacheConfig";
+
private IdentitySessionFactory identitySessionFactory;
private String config;
private String realmName = "idm_realm";
- private String cacheConfig;
-
private IdentityConfiguration identityConfiguration;
private PicketLinkIDMServiceImpl()
@@ -87,7 +89,8 @@
ValueParam config = initParams.getValueParam(PARAM_CONFIG_OPTION);
ValueParam jndiName = initParams.getValueParam(PARAM_JNDI_NAME_OPTION);
ValueParam realmName = initParams.getValueParam(REALM_NAME_OPTION);
- ValueParam cacheConfig = initParams.getValueParam(CACHE_CONFIG_OPTION);
+ ValueParam apiCacheConfig = initParams.getValueParam(CACHE_CONFIG_API_OPTION);
+ ValueParam storeCacheConfig = initParams.getValueParam(CACHE_CONFIG_STORE_OPTION);
if (config == null && jndiName == null)
{
@@ -118,14 +121,32 @@
identityConfiguration.getIdentityConfigurationRegistry().register(hibernateService.getSessionFactory(),
"hibernateSessionFactory");
- if (cacheConfig != null)
+ if (apiCacheConfig != null)
{
- InputStream configStream =
confManager.getInputStream(cacheConfig.getValue());
- JBossCacheAPICacheProviderImpl cacheProvider = new
JBossCacheAPICacheProviderImpl();
- cacheProvider.initialize(configStream);
- picketLinkIDMCache.register(cacheProvider);
-
identityConfiguration.getIdentityConfigurationRegistry().register(cacheProvider,
"apiCacheProvider");
+ InputStream configStream =
confManager.getInputStream(apiCacheConfig.getValue());
+
+
+ JBossCacheAPICacheProviderImpl apiCacheProvider = new
JBossCacheAPICacheProviderImpl();
+ apiCacheProvider.initialize(configStream);
+ picketLinkIDMCache.register(apiCacheProvider);
+
identityConfiguration.getIdentityConfigurationRegistry().register(apiCacheProvider,
"apiCacheProvider");
+
+ configStream.close();
+
}
+ if (storeCacheConfig != null)
+ {
+ InputStream configStream =
confManager.getInputStream(storeCacheConfig.getValue());
+
+ JBossCacheIdentityStoreCacheProviderImpl storeCacheProvider = new
JBossCacheIdentityStoreCacheProviderImpl();
+ storeCacheProvider.initialize(configStream);
+ picketLinkIDMCache.register(storeCacheProvider);
+
identityConfiguration.getIdentityConfigurationRegistry().register(storeCacheProvider,
"storeCacheProvider");
+
+
+ configStream.close();
+
+ }
}
else
{
Modified: portal/branches/EPP_5_0_Branch/pom.xml
===================================================================
--- portal/branches/EPP_5_0_Branch/pom.xml 2010-04-29 13:46:58 UTC (rev 2893)
+++ portal/branches/EPP_5_0_Branch/pom.xml 2010-04-29 14:34:27 UTC (rev 2894)
@@ -47,7 +47,7 @@
<org.gatein.common.version>2.0.2-GA</org.gatein.common.version>
<org.gatein.wci.version>2.0.1-GA</org.gatein.wci.version>
<org.gatein.pc.version>2.1.1-GA</org.gatein.pc.version>
- <org.picketlink.idm>1.1.2.GA</org.picketlink.idm>
+ <org.picketlink.idm>1.1.3.GA</org.picketlink.idm>
<org.gatein.wsrp.version>1.1.0-GA</org.gatein.wsrp.version>
<org.gatein.mop.version>1.0.2-GA</org.gatein.mop.version>
<org.slf4j.version>1.5.6</org.slf4j.version>
Modified:
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/WEB-INF/conf/organization/idm-configuration.xml
===================================================================
---
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/WEB-INF/conf/organization/idm-configuration.xml 2010-04-29
13:46:58 UTC (rev 2893)
+++
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/WEB-INF/conf/organization/idm-configuration.xml 2010-04-29
14:34:27 UTC (rev 2894)
@@ -91,15 +91,25 @@
</value-param>
<value-param>
- <name>cacheConfig</name>
+ <name>apiCacheConfig</name>
<value>war:/conf/organization/picketlink-idm/jboss-cache.xml</value>
</value-param>
<value-param profiles="cluster">
- <name>cacheConfig</name>
+ <name>apiCacheConfig</name>
<value>war:/conf/organization/picketlink-idm/jboss-cache-cluster.xml</value>
</value-param>
+ <value-param>
+ <name>storeCacheConfig</name>
+ <value>war:/conf/organization/picketlink-idm/jboss-cache.xml</value>
+ </value-param>
+
+ <value-param profiles="cluster">
+ <name>storeCacheConfig</name>
+
<value>war:/conf/organization/picketlink-idm/jboss-cache-cluster.xml</value>
+ </value-param>
+
</init-params>
</component>
Modified:
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/examples/picketlink-idm-ldap-acme-config.xml
===================================================================
---
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/examples/picketlink-idm-ldap-acme-config.xml 2010-04-29
13:46:58 UTC (rev 2893)
+++
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/examples/picketlink-idm-ldap-acme-config.xml 2010-04-29
14:34:27 UTC (rev 2894)
@@ -373,8 +373,11 @@
<name>customSystemProperties</name>
<value>com.sun.jndi.ldap.connect.pool.maxsize=300000</value>
<value>com.sun.jndi.ldap.connect.pool.protocol=plain ssl</value>
- <value>com.sun.jndi.ldap.connect.pool.debug=fine</value>
</option>
+ <option>
+ <name>cache.providerRegistryName</name>
+ <value>storeCacheProvider</value>
+ </option>
</options>
</identity-store>
</identity-stores>
Modified:
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/examples/picketlink-idm-ldap-config.xml
===================================================================
---
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/examples/picketlink-idm-ldap-config.xml 2010-04-29
13:46:58 UTC (rev 2893)
+++
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/examples/picketlink-idm-ldap-config.xml 2010-04-29
14:34:27 UTC (rev 2894)
@@ -334,8 +334,11 @@
<name>customSystemProperties</name>
<value>com.sun.jndi.ldap.connect.pool.maxsize=300000</value>
<value>com.sun.jndi.ldap.connect.pool.protocol=plain ssl</value>
- <value>com.sun.jndi.ldap.connect.pool.debug=fine</value>
</option>
+ <option>
+ <name>cache.providerRegistryName</name>
+ <value>storeCacheProvider</value>
+ </option>
</options>
</identity-store>
</identity-stores>
Modified:
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/examples/picketlink-idm-msad-config.xml
===================================================================
---
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/examples/picketlink-idm-msad-config.xml 2010-04-29
13:46:58 UTC (rev 2893)
+++
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/examples/picketlink-idm-msad-config.xml 2010-04-29
14:34:27 UTC (rev 2894)
@@ -382,8 +382,11 @@
<name>customSystemProperties</name>
<value>com.sun.jndi.ldap.connect.pool.maxsize=300000</value>
<value>com.sun.jndi.ldap.connect.pool.protocol=plain ssl</value>
- <value>com.sun.jndi.ldap.connect.pool.debug=fine</value>
</option>
+ <option>
+ <name>cache.providerRegistryName</name>
+ <value>storeCacheProvider</value>
+ </option>
</options>
</identity-store>
</identity-stores>
Modified:
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/examples/picketlink-idm-msad-readonly-config.xml
===================================================================
---
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/examples/picketlink-idm-msad-readonly-config.xml 2010-04-29
13:46:58 UTC (rev 2893)
+++
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/examples/picketlink-idm-msad-readonly-config.xml 2010-04-29
14:34:27 UTC (rev 2894)
@@ -336,8 +336,11 @@
<name>customSystemProperties</name>
<value>com.sun.jndi.ldap.connect.pool.maxsize=300000</value>
<value>com.sun.jndi.ldap.connect.pool.protocol=plain ssl</value>
- <value>com.sun.jndi.ldap.connect.pool.debug=fine</value>
</option>
+ <option>
+ <name>cache.providerRegistryName</name>
+ <value>storeCacheProvider</value>
+ </option>
</options>
</identity-store>
</identity-stores>
Modified:
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/examples/picketlink-idm-openldap-acme-config.xml
===================================================================
---
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/examples/picketlink-idm-openldap-acme-config.xml 2010-04-29
13:46:58 UTC (rev 2893)
+++
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/examples/picketlink-idm-openldap-acme-config.xml 2010-04-29
14:34:27 UTC (rev 2894)
@@ -388,8 +388,11 @@
<name>customSystemProperties</name>
<value>com.sun.jndi.ldap.connect.pool.maxsize=300000</value>
<value>com.sun.jndi.ldap.connect.pool.protocol=plain ssl</value>
- <value>com.sun.jndi.ldap.connect.pool.debug=fine</value>
</option>
+ <option>
+ <name>cache.providerRegistryName</name>
+ <value>storeCacheProvider</value>
+ </option>
</options>
</identity-store>
</identity-stores>
Modified:
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/examples/picketlink-idm-openldap-config.xml
===================================================================
---
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/examples/picketlink-idm-openldap-config.xml 2010-04-29
13:46:58 UTC (rev 2893)
+++
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/examples/picketlink-idm-openldap-config.xml 2010-04-29
14:34:27 UTC (rev 2894)
@@ -348,8 +348,11 @@
<name>customSystemProperties</name>
<value>com.sun.jndi.ldap.connect.pool.maxsize=300000</value>
<value>com.sun.jndi.ldap.connect.pool.protocol=plain ssl</value>
- <value>com.sun.jndi.ldap.connect.pool.debug=fine</value>
</option>
+ <option>
+ <name>cache.providerRegistryName</name>
+ <value>storeCacheProvider</value>
+ </option>
</options>
</identity-store>
</identity-stores>