Author: bdaw
Date: 2012-03-28 04:03:48 -0400 (Wed, 28 Mar 2012)
New Revision: 1543
Modified:
idm/branches/1.1.0/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/store/ldap/LDAPIdentityStoreConfiguration.java
idm/branches/1.1.0/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/store/ldap/LDAPIdentityStoreImpl.java
idm/branches/1.1.0/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/store/ldap/SimpleLDAPIdentityStoreConfiguration.java
Log:
PLIDM-37 Configuration switch to not cache empty LDAP results
Modified:
idm/branches/1.1.0/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/store/ldap/LDAPIdentityStoreConfiguration.java
===================================================================
---
idm/branches/1.1.0/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/store/ldap/LDAPIdentityStoreConfiguration.java 2012-03-26
21:55:35 UTC (rev 1542)
+++
idm/branches/1.1.0/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/store/ldap/LDAPIdentityStoreConfiguration.java 2012-03-28
08:03:48 UTC (rev 1543)
@@ -93,5 +93,7 @@
int getPagedExtensionSize();
public boolean isAllowNotCaseSensitiveSearch();
+
+ public boolean isCacheEmptySearchResults();
}
Modified:
idm/branches/1.1.0/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/store/ldap/LDAPIdentityStoreImpl.java
===================================================================
---
idm/branches/1.1.0/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/store/ldap/LDAPIdentityStoreImpl.java 2012-03-26
21:55:35 UTC (rev 1542)
+++
idm/branches/1.1.0/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/store/ldap/LDAPIdentityStoreImpl.java 2012-03-28
08:03:48 UTC (rev 1543)
@@ -3885,7 +3885,9 @@
ldapContext.close();
}
- if (getCache() != null && finalResults != null)
+ if (getCache() != null
+ && finalResults != null
+ && (finalResults.size() > 0 ||
configuration.isCacheEmptySearchResults()))
{
LDAPSearch search =
new LDAPSearch(entryCtxs, filter, filterArgs, returningAttributes,
searchScope, requestControls);
Modified:
idm/branches/1.1.0/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/store/ldap/SimpleLDAPIdentityStoreConfiguration.java
===================================================================
---
idm/branches/1.1.0/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/store/ldap/SimpleLDAPIdentityStoreConfiguration.java 2012-03-26
21:55:35 UTC (rev 1542)
+++
idm/branches/1.1.0/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/store/ldap/SimpleLDAPIdentityStoreConfiguration.java 2012-03-28
08:03:48 UTC (rev 1543)
@@ -95,7 +95,9 @@
private final boolean allowNotCaseSensitiveSearch;
+ private final boolean cacheEmptySearchResults;
+
// Consts
public static final String PROVIDER_URL = "providerURL";
@@ -152,6 +154,9 @@
public static final String ALLOW_NOT_CASE_SENSITIVE_SEARCH =
"allowNotCaseSensitiveSearch";
+ public static final String CACHE_EMPTY_SEARCH_RESULTS =
"cacheEmptySearchResults";
+
+
public SimpleLDAPIdentityStoreConfiguration(IdentityStoreConfigurationMetaData
storeMD)
{
if (storeMD == null)
@@ -246,6 +251,16 @@
this.allowNotCaseSensitiveSearch = false;
}
+ String cacheEmptySearchResults =
storeMD.getOptionSingleValue(CACHE_EMPTY_SEARCH_RESULTS);
+ if (cacheEmptySearchResults != null &&
cacheEmptySearchResults.equalsIgnoreCase("false"))
+ {
+ this.cacheEmptySearchResults = false;
+ }
+ else
+ {
+ this.cacheEmptySearchResults = true;
+ }
+
Map<String, LDAPIdentityObjectTypeConfiguration> types = new
HashMap<String, LDAPIdentityObjectTypeConfiguration>();
for (IdentityObjectTypeMetaData identityObjectTypeMetaData :
storeMD.getSupportedIdentityTypes())
@@ -568,4 +583,9 @@
{
return allowNotCaseSensitiveSearch;
}
+
+ public boolean isCacheEmptySearchResults()
+ {
+ return cacheEmptySearchResults;
+ }
}
Show replies by date