Author: mageshbk(a)jboss.com
Date: 2009-06-09 07:24:12 -0400 (Tue, 09 Jun 2009)
New Revision: 13441
Modified:
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/build/build-thirdparty.xml
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/BaseRoleAction.java
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core/src/main/org/jboss/portal/core/identity/cache/CachedLDAPRoleModuleWrapper.java
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core/src/main/org/jboss/portal/core/identity/cache/IdentityCacheService.java
Log:
[JBEPP-78] Less optimal implementation of role display name duplicate checking albeit
without API changes. Reverted to identity version 1.1.0.
Modified:
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/build/build-thirdparty.xml
===================================================================
---
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/build/build-thirdparty.xml 2009-06-09
08:58:05 UTC (rev 13440)
+++
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/build/build-thirdparty.xml 2009-06-09
11:24:12 UTC (rev 13441)
@@ -1,4 +1,26 @@
<?xml version="1.0"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2009, Red Hat Middleware, LLC, and individual
+ ~ contributors as indicated by the @authors tag. See the
+ ~ copyright.txt in the distribution for a full listing of
+ ~ individual contributors.
+ ~
+ ~ This is free software; you can redistribute it and/or modify it
+ ~ under the terms of the GNU Lesser General Public License as
+ ~ published by the Free Software Foundation; either version 2.1 of
+ ~ the License, or (at your option) any later version.
+ ~
+ ~ This software is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ ~ Lesser General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public
+ ~ License along with this software; if not, write to the Free
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ ~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<project name="main.build" default="synchronize"
basedir=".">
<!-- Property File definitions -->
@@ -45,7 +67,7 @@
<componentref name="jboss-portal/modules/web"
version="1.2.3"/>
<componentref name="jboss-portal/modules/test"
version="1.0.4"/>
<componentref name="jboss-portal/modules/portlet"
version="2.0.7"/>
- <componentref name="jboss-portal/modules/identity"
version="1.1.0_JBEPP-78"/>
+ <componentref name="jboss-portal/modules/identity"
version="1.1.0"/>
<componentref name="jboss-portal/modules/cms"
version="1.2.5"/>
<componentref name="antlr" version="2.7.6-brew"/>
<componentref name="apache-ant" version="1.6.5"/>
Modified:
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core/src/main/org/jboss/portal/core/identity/cache/CachedLDAPRoleModuleWrapper.java
===================================================================
---
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core/src/main/org/jboss/portal/core/identity/cache/CachedLDAPRoleModuleWrapper.java 2009-06-09
08:58:05 UTC (rev 13440)
+++
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core/src/main/org/jboss/portal/core/identity/cache/CachedLDAPRoleModuleWrapper.java 2009-06-09
11:24:12 UTC (rev 13441)
@@ -63,18 +63,6 @@
return ldapRoleModule.findRoleByName(name);
}
- public Role findRoleByDisplayName(String displayName) throws IdentityException,
IllegalArgumentException
- {
- Role role = cacheService.findRoleByDisplayName(displayName);
-
- if (role != null)
- {
- return role;
- }
-
- return ldapRoleModule.findRoleByDisplayName(displayName);
- }
-
public Set findRolesByNames(String[] names) throws IdentityException,
IllegalArgumentException
{
Modified:
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core/src/main/org/jboss/portal/core/identity/cache/IdentityCacheService.java
===================================================================
---
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core/src/main/org/jboss/portal/core/identity/cache/IdentityCacheService.java 2009-06-09
08:58:05 UTC (rev 13440)
+++
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core/src/main/org/jboss/portal/core/identity/cache/IdentityCacheService.java 2009-06-09
11:24:12 UTC (rev 13441)
@@ -47,8 +47,6 @@
protected ThreadLocal<Map<String, Role>> roleNameCache = new
ThreadLocal<Map<String, Role>>();
- protected ThreadLocal<Map<String, Role>> roleDisplayNameCache = new
ThreadLocal<Map<String, Role>>();
-
protected ThreadLocal<Map<Object, Role>> roleIdCache = new
ThreadLocal<Map<Object, Role>>();
@@ -58,7 +56,6 @@
userIdCache.set(null);
profileCache.set(null);
roleNameCache.set(null);
- roleDisplayNameCache.set(null);
roleIdCache.set(null);
log.debug("Identity cache invalidated");
@@ -100,15 +97,6 @@
return roleNameCache.get();
}
- private Map<String, Role> getRoleDisplayNameCache()
- {
- if (roleDisplayNameCache.get() == null)
- {
- roleDisplayNameCache.set(new HashMap<String, Role>());
- }
- return roleDisplayNameCache.get();
- }
-
private Map<Object, Role> getRoleIdCache()
{
if (roleIdCache.get() == null)
@@ -184,7 +172,6 @@
{
getRoleIdCache().put(role.getId(), role);
getRoleNameCache().put(role.getName(), role);
- getRoleDisplayNameCache().put(role.getDisplayName(), role);
if (log.isDebugEnabled())
{
@@ -200,7 +187,6 @@
{
getRoleIdCache().put(role.getId(), null);
getRoleNameCache().put(role.getName(), null);
- getRoleDisplayNameCache().put(role.getDisplayName(), null);
if (log.isDebugEnabled())
{
@@ -257,18 +243,6 @@
return role;
}
- public Role findRoleByDisplayName(String displayName)
- {
- Role role = getRoleDisplayNameCache().get(displayName);
-
- if (role != null && log.isDebugEnabled())
- {
- log.debug("Role retrieved from cache for display name=" +
role.getDisplayName());
- }
-
- return role;
- }
-
public Role findRoleById(Object id)
{
Role role = getRoleIdCache().get(id);
Modified:
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/BaseRoleAction.java
===================================================================
---
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/BaseRoleAction.java 2009-06-09
08:58:05 UTC (rev 13440)
+++
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/BaseRoleAction.java 2009-06-09
11:24:12 UTC (rev 13441)
@@ -27,7 +27,11 @@
import org.jboss.portal.core.identity.ui.common.IdentityRoleBean;
import org.jboss.portal.faces.gui.ManagedBean;
import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.Role;
+import org.jboss.portal.identity.RoleModule;
+import java.util.Set;
+
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
* @version $Revision$
@@ -57,13 +61,25 @@
{
try
{
+ RoleModule roleModule = identityRoleBean.getRoleModule();
if (isDisplay)
{
- return identityRoleBean.getRoleModule().findRoleByDisplayName(objectName) !=
null;
+ // performance: this could potentially be costly if there are lots of
roles...
+ Set roles = roleModule.findRoles();
+ for (Object o : roles)
+ {
+ Role role = (Role)o;
+ if (role.getDisplayName().equals(objectName))
+ {
+ return true;
+ }
+ }
+
+ return false;
}
else
{
- return identityRoleBean.getRoleModule().findRoleByName(objectName) != null;
+ return roleModule.findRoleByName(objectName) != null;
}
}
catch (IdentityException e)