JBoss Portal SVN: r10792 - in branches/JBoss_Portal_Branch_2_6: core/src/main/org/jboss/portal/core/aspects/server and 5 other directories.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2008-05-21 10:11:59 -0400 (Wed, 21 May 2008)
New Revision: 10792
Added:
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/aspects/server/IdentityCacheInterceptor.java
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/identity/cache/
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/identity/cache/CachedLDAPRoleModuleWrapper.java
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/identity/cache/CachedLDAPUserModuleWrapper.java
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/identity/cache/CachedUserProfileModuleWrapper.java
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/identity/cache/IdentityCacheService.java
Modified:
branches/JBoss_Portal_Branch_2_6/build/build-thirdparty.xml
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/identity/service/IdentityServiceControllerImpl.java
branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/conf/login-config.xml
Log:
LDAP performance improvements
Modified: branches/JBoss_Portal_Branch_2_6/build/build-thirdparty.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/build/build-thirdparty.xml 2008-05-21 13:27:04 UTC (rev 10791)
+++ branches/JBoss_Portal_Branch_2_6/build/build-thirdparty.xml 2008-05-21 14:11:59 UTC (rev 10792)
@@ -51,7 +51,7 @@
<componentref name="jboss-portal/modules/web" version="1.1.0"/>
<componentref name="jboss-portal/modules/test" version="1.0.1"/>
<componentref name="jboss-portal/modules/portlet" version="1.0.3"/>
- <componentref name="jboss-portal/modules/identity" version="1.0.3"/>
+ <componentref name="jboss-portal/modules/identity" version="1.0-SNAPSHOT"/>
<componentref name="antlr" version="2.7.6.ga"/>
<componentref name="apache-ant" version="1.6.5"/>
<componentref name="jackrabbit" version="1.1.1"/>
Added: branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/aspects/server/IdentityCacheInterceptor.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/aspects/server/IdentityCacheInterceptor.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/aspects/server/IdentityCacheInterceptor.java 2008-05-21 14:11:59 UTC (rev 10792)
@@ -0,0 +1,88 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, 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.
+*/
+
+package org.jboss.portal.core.aspects.server;
+
+import org.jboss.portal.core.identity.cache.IdentityCacheService;
+import org.jboss.portal.server.ServerInterceptor;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.common.invocation.InvocationException;
+import org.jboss.logging.Logger;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class IdentityCacheInterceptor extends ServerInterceptor
+{
+
+ /** Our logger. */
+ private static final Logger log = Logger.getLogger(IdentityCacheInterceptor.class);
+
+ private IdentityCacheService identityCacheService;
+
+ public IdentityCacheService getIdentityCacheService()
+ {
+ if (identityCacheService == null)
+ {
+ try
+ {
+ identityCacheService = (IdentityCacheService)new InitialContext().lookup(IdentityCacheService.JNDI_NAME);
+ }
+ catch (NamingException e)
+ {
+ log.debug("Could not obtain IdentityCacheService. Setting empty wrapper");
+ identityCacheService = new EmptyIdentityCache();
+ }
+ }
+ return identityCacheService;
+ }
+
+ protected void invoke(ServerInvocation invocation) throws Exception, InvocationException
+ {
+
+ try
+ {
+ invocation.invokeNext();
+ }
+ finally
+ {
+ IdentityCacheService cache = getIdentityCacheService();
+ if (cache != null)
+ {
+ cache.cleanup();
+ }
+ }
+
+ }
+
+ private class EmptyIdentityCache extends IdentityCacheService
+ {
+ public void cleanup()
+ {
+ // Do nothing
+ }
+ }
+}
Added: branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/identity/cache/CachedLDAPRoleModuleWrapper.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/identity/cache/CachedLDAPRoleModuleWrapper.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/identity/cache/CachedLDAPRoleModuleWrapper.java 2008-05-21 14:11:59 UTC (rev 10792)
@@ -0,0 +1,161 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, 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.
+*/
+
+package org.jboss.portal.core.identity.cache;
+
+import org.jboss.portal.identity.ldap.LDAPRoleModule;
+import org.jboss.portal.identity.ldap.LDAPRoleImpl;
+import org.jboss.portal.identity.RoleModule;
+import org.jboss.portal.identity.Role;
+import org.jboss.portal.identity.IdentityException;
+
+import javax.naming.NamingException;
+import javax.naming.directory.Attributes;
+import java.util.Set;
+import java.util.List;
+import java.util.HashSet;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class CachedLDAPRoleModuleWrapper extends LDAPRoleModule implements RoleModule
+{
+ private LDAPRoleModule ldapRoleModule;
+
+ private IdentityCacheService cacheService;
+
+ public CachedLDAPRoleModuleWrapper(LDAPRoleModule ldapRoleModule, IdentityCacheService cacheService)
+ {
+ this.ldapRoleModule = ldapRoleModule;
+ this.cacheService = cacheService;
+ }
+
+ public Role findRoleByName(String name) throws IdentityException, IllegalArgumentException
+ {
+ Role role = cacheService.findRoleByName(name);
+
+ if (role != null)
+ {
+ return role;
+ }
+
+ return ldapRoleModule.findRoleByName(name);
+ }
+
+ public Set findRolesByNames(String[] names) throws IdentityException, IllegalArgumentException
+ {
+
+ //Check if all roles needed are in cache. If not just delegate to the wrapped module
+ Set roles = new HashSet();
+
+ for (String name : names)
+ {
+ Role role = cacheService.findRoleByName(name);
+ if (role != null)
+ {
+ roles.add(role);
+ }
+ else
+ {
+ roles = ldapRoleModule.findRolesByNames(names);
+ break;
+ }
+ }
+
+ return roles;
+ }
+
+ public Role findRoleById(Object id) throws IdentityException, IllegalArgumentException
+ {
+ Role role = cacheService.findRoleById(id);
+
+ if (role != null)
+ {
+ return role;
+ }
+
+ return ldapRoleModule.findRoleById(id);
+ }
+
+ public Role findRoleById(String id) throws IdentityException, IllegalArgumentException
+ {
+ return this.findRoleById((Object)id);
+ }
+
+ public Role createRole(String name, String displayName) throws IdentityException, IllegalArgumentException
+ {
+ Role role = ldapRoleModule.createRole(name, displayName);
+
+ cacheService.storeRole(role);
+
+ return role;
+ }
+
+ public void removeRole(Object id) throws IdentityException, IllegalArgumentException
+ {
+ ldapRoleModule.removeRole(id);
+
+ // Invalidate this role in cache
+ Role role = cacheService.findRoleById(id);
+ if (role != null)
+ {
+ cacheService.invalidateRole(role);
+ }
+ }
+
+ public int getRolesCount() throws IdentityException
+ {
+ return ldapRoleModule.getRolesCount();
+ }
+
+ public Set findRoles() throws IdentityException
+ {
+ return ldapRoleModule.findRoles();
+ }
+
+ public List searchRoles(String filter, Object[] filterArgs) throws NamingException, IdentityException
+ {
+ return ldapRoleModule.searchRoles(filter, filterArgs);
+ }
+
+ // Methods of LDAPRoleModule - need to delegate for compatibility
+
+ public void updateDisplayName(LDAPRoleImpl ldapr, String name) throws IdentityException
+ {
+ ldapRoleModule.updateDisplayName(ldapr, name);
+
+ cacheService.invalidateRole(ldapr);
+ }
+
+ public LDAPRoleImpl createRoleInstance(Attributes attrs, String dn) throws IdentityException
+ {
+ return ldapRoleModule.createRoleInstance(attrs, dn);
+ }
+
+ public Role findRoleByDN(String dn) throws IdentityException, IllegalArgumentException
+ {
+ return ldapRoleModule.findRoleByDN(dn);
+ }
+
+
+}
Added: branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/identity/cache/CachedLDAPUserModuleWrapper.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/identity/cache/CachedLDAPUserModuleWrapper.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/identity/cache/CachedLDAPUserModuleWrapper.java 2008-05-21 14:11:59 UTC (rev 10792)
@@ -0,0 +1,168 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, 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.
+*/
+
+package org.jboss.portal.core.identity.cache;
+
+import org.jboss.portal.identity.UserModule;
+import org.jboss.portal.identity.User;
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.NoSuchUserException;
+import org.jboss.portal.identity.IdentityContext;
+import org.jboss.portal.identity.UserProfileModule;
+import org.jboss.portal.identity.Role;
+import org.jboss.portal.identity.ldap.LDAPUserModule;
+import org.jboss.portal.identity.ldap.LDAPUserImpl;
+import org.jboss.portal.identity.ldap.LDAPConnectionContext;
+import org.jboss.portal.identity.service.IdentityModuleService;
+
+import javax.naming.NamingException;
+import javax.naming.directory.Attributes;
+import java.util.Set;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class CachedLDAPUserModuleWrapper extends LDAPUserModule implements UserModule
+{
+ private LDAPUserModule userModule;
+
+ private IdentityCacheService cacheService;
+
+ private static final org.jboss.logging.Logger log = org.jboss.logging.Logger.getLogger(CachedLDAPUserModuleWrapper.class);
+
+ public CachedLDAPUserModuleWrapper(LDAPUserModule userModule, IdentityCacheService cacheService)
+ {
+ this.userModule = userModule;
+ this.cacheService = cacheService;
+ }
+
+
+ public User findUserByUserName(String userName) throws IdentityException, IllegalArgumentException, NoSuchUserException
+ {
+ if (userName == null)
+ {
+ throw new IllegalArgumentException("UserName cannot be null");
+ }
+
+ User user = cacheService.findUserByUserName(userName);
+
+ if (user != null)
+ {
+ return user;
+ }
+
+ user = userModule.findUserByUserName(userName);
+
+ cacheService.storeUser(user);
+
+ return user;
+ }
+
+ public User findUserById(Object id) throws IdentityException, IllegalArgumentException, NoSuchUserException
+ {
+ if (id == null)
+ {
+ throw new IllegalArgumentException("User id cannot be null");
+ }
+
+ User user = cacheService.findUserById(id);
+
+ if (user != null)
+ {
+ return user;
+ }
+
+ user = userModule.findUserById(id);
+
+ cacheService.storeUser(user);
+
+ return user;
+ }
+
+ public User findUserById(String id) throws IdentityException, IllegalArgumentException, NoSuchUserException
+ {
+ return findUserById((Object)id);
+ }
+
+ public User createUser(String userName, String password) throws IdentityException, IllegalArgumentException
+ {
+ return userModule.createUser(userName, password);
+ }
+
+ public void removeUser(Object id) throws IdentityException, IllegalArgumentException
+ {
+ userModule.removeUser(id);
+
+ // Invalidate this user in cache
+ User user = cacheService.findUserById(id);
+ if (user != null)
+ {
+ cacheService.invalidateUser(user);
+ }
+ }
+
+ public Set findUsers(int offset, int limit) throws IdentityException, IllegalArgumentException
+ {
+ return userModule.findUsers(offset, limit);
+ }
+
+ public Set findUsersFilteredByUserName(String filter, int offset, int limit) throws IdentityException, IllegalArgumentException
+ {
+ return userModule.findUsersFilteredByUserName(filter, offset, limit);
+ }
+
+ public int getUserCount() throws IdentityException, IllegalArgumentException
+ {
+ return userModule.getUserCount();
+ }
+
+ public List searchUsers(String filter, Object[] filterArgs) throws NamingException, IdentityException
+ {
+ return userModule.searchUsers(filter, filterArgs);
+ }
+
+ public void updatePassword(LDAPUserImpl ldapu, String password) throws IdentityException
+ {
+ userModule.updatePassword(ldapu, password);
+ }
+
+ public boolean validatePassword(LDAPUserImpl ldapu, String password) throws IdentityException
+ {
+ return userModule.validatePassword(ldapu, password);
+ }
+
+ // Methods of LDAPUserModule - need to delegate for compatibility
+ public LDAPUserImpl createUserInstance(Attributes attrs, String dn) throws IdentityException
+ {
+ return userModule.createUserInstance(attrs, dn);
+ }
+
+ public User findUserByDN(String dn) throws IdentityException, IllegalArgumentException, NoSuchUserException
+ {
+ return userModule.findUserByDN(dn);
+ }
+
+
+}
Added: branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/identity/cache/CachedUserProfileModuleWrapper.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/identity/cache/CachedUserProfileModuleWrapper.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/identity/cache/CachedUserProfileModuleWrapper.java 2008-05-21 14:11:59 UTC (rev 10792)
@@ -0,0 +1,95 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, 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.
+*/
+
+package org.jboss.portal.core.identity.cache;
+
+import org.jboss.portal.identity.UserProfileModule;
+import org.jboss.portal.identity.User;
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.info.ProfileInfo;
+import org.jboss.logging.Logger;
+
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class CachedUserProfileModuleWrapper implements UserProfileModule
+{
+
+ private static final Logger log = Logger.getLogger(CachedUserProfileModuleWrapper.class);
+
+ private UserProfileModule userProfileModule;
+
+ private IdentityCacheService cacheService;
+
+ public CachedUserProfileModuleWrapper(UserProfileModule userProfileModule, IdentityCacheService identityCacheService)
+ {
+ this.userProfileModule = userProfileModule;
+ this.cacheService = identityCacheService;
+ }
+
+ public Object getProperty(User user, String propertyName) throws IdentityException, IllegalArgumentException
+ {
+ // Just grab the whole profile and check if this property is there
+
+ Map profile = this.getProperties(user);
+
+ if (profile != null && profile.containsKey(propertyName))
+ {
+
+ return profile.get(propertyName);
+ }
+
+ // else delegate to the wrapped implementation
+
+ return userProfileModule.getProperty(user, propertyName);
+
+ }
+
+ public void setProperty(User user, String name, Object property) throws IdentityException, IllegalArgumentException
+ {
+ userProfileModule.setProperty(user, name, property);
+ cacheService.invalidateProfile(user);
+
+ }
+
+ public Map getProperties(User user) throws IdentityException, IllegalArgumentException
+ {
+ Map profile = cacheService.findUserProfileById(user.getId());
+
+ if (profile != null)
+ {
+ return profile;
+ }
+
+ profile = userProfileModule.getProperties(user);
+ cacheService.storeProfile(user, profile);
+ return profile;
+ }
+
+ public ProfileInfo getProfileInfo() throws IdentityException
+ {
+ return userProfileModule.getProfileInfo();
+ }
+}
Added: branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/identity/cache/IdentityCacheService.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/identity/cache/IdentityCacheService.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/identity/cache/IdentityCacheService.java 2008-05-21 14:11:59 UTC (rev 10792)
@@ -0,0 +1,258 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, 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.
+*/
+
+package org.jboss.portal.core.identity.cache;
+
+import org.jboss.portal.identity.User;
+import org.jboss.portal.identity.Role;
+
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class IdentityCacheService
+{
+ private static final org.jboss.logging.Logger log = org.jboss.logging.Logger.getLogger(IdentityCacheService.class);
+
+ public final static String JNDI_NAME = "java:portal/IdentityCacheService";
+
+ protected ThreadLocal<Map<String, User>> userNameCache = new ThreadLocal<Map<String, User>>();
+
+ protected ThreadLocal<Map<Object, User>> userIdCache = new ThreadLocal<Map<Object, User>>();
+
+ protected ThreadLocal<Map<Object, Map>> profileCache = new ThreadLocal<Map<Object, Map>>();
+
+ protected ThreadLocal<Map<String, Role>> roleNameCache = new ThreadLocal<Map<String, Role>>();
+
+ protected ThreadLocal<Map<Object, Role>> roleIdCache = new ThreadLocal<Map<Object, Role>>();
+
+
+ public void cleanup()
+ {
+ userNameCache.set(null);
+ userIdCache.set(null);
+ profileCache.set(null);
+ roleNameCache.set(null);
+ roleIdCache.set(null);
+
+ log.debug("Identity cache invalidated");
+ }
+
+ private Map<String, User> getUserNameCache()
+ {
+ if (userNameCache.get() == null)
+ {
+ userNameCache.set(new HashMap<String, User>());
+ }
+ return userNameCache.get();
+ }
+
+ private Map<Object, User> getUserIdCache()
+ {
+ if (userIdCache.get() == null)
+ {
+ userIdCache.set(new HashMap<Object, User>());
+ }
+ return userIdCache.get();
+ }
+
+ private Map<Object, Map> getProfileCache()
+ {
+ if (profileCache.get() == null)
+ {
+ profileCache.set(new HashMap<Object, Map>());
+ }
+ return profileCache.get();
+ }
+
+ private Map<String, Role> getRoleNameCache()
+ {
+ if (roleNameCache.get() == null)
+ {
+ roleNameCache.set(new HashMap<String, Role>());
+ }
+ return roleNameCache.get();
+ }
+
+ private Map<Object, Role> getRoleIdCache()
+ {
+ if (roleIdCache.get() == null)
+ {
+ roleIdCache.set(new HashMap<Object, Role>());
+ }
+ return roleIdCache.get();
+ }
+
+ public void storeUser(User user)
+ {
+ // We want to be transparent so just ignore null argument
+ if (user != null)
+ {
+ getUserIdCache().put(user.getId(), user);
+ getUserNameCache().put(user.getUserName(), user);
+
+ if (log.isDebugEnabled())
+ {
+ log.debug("User cached for id=" + user.getId() + "; username=" + user.getUserName());
+ }
+ }
+ }
+
+ public void invalidateUser(User user)
+ {
+ // We want to be transparent so just ignore null argument
+ if (user != null)
+ {
+ getUserIdCache().put(user.getId(), null);
+ getUserNameCache().put(user.getUserName(), null);
+
+ if (log.isDebugEnabled())
+ {
+ log.debug("User invalidated in cache for id=" + user.getId() + "; username=" + user.getUserName());
+ }
+ }
+ }
+
+ public void storeProfile(User user, Map profile)
+ {
+ // We want to be transparent so just ignore null argument
+ if (user != null && profile != null)
+ {
+ getProfileCache().put(user.getId(), profile);
+
+ if (log.isDebugEnabled())
+ {
+ log.debug("User profile cached for id=" + user.getId());
+ }
+ }
+ }
+
+
+ public void invalidateProfile(User user)
+ {
+ // We want to be transparent so just ignore null argument
+ if (user != null)
+ {
+ getProfileCache().put(user.getId(), null);
+
+ if (log.isDebugEnabled())
+ {
+ log.debug("User profile invalidated in cache for id=" + user.getId());
+ }
+ }
+ }
+
+ public void storeRole(Role role)
+ {
+ // We want to be transparent so just ignore null argument
+ if (role != null)
+ {
+ getRoleIdCache().put(role.getId(), role);
+ getRoleNameCache().put(role.getName(), role);
+
+ if (log.isDebugEnabled())
+ {
+ log.debug("Role cached for id=" + role.getId() + "; name=" + role.getName());
+ }
+ }
+ }
+
+ public void invalidateRole(Role role)
+ {
+ // We want to be transparent so just ignore null argument
+ if (role != null)
+ {
+ getRoleIdCache().put(role.getId(), null);
+ getRoleNameCache().put(role.getName(), null);
+
+ if (log.isDebugEnabled())
+ {
+ log.debug("Role invalidated in cache for id=" + role.getId() + "; name=" + role.getName());
+ }
+ }
+ }
+
+ public User findUserByUserName(String userName)
+ {
+ User user = getUserNameCache().get(userName);
+
+ if (user != null && log.isDebugEnabled())
+ {
+ log.debug("User retreived from cache for username=" + user.getUserName());
+ }
+
+ return user;
+ }
+
+ public User findUserById(Object id)
+ {
+ User user = getUserIdCache().get(id);
+
+ if (user != null && log.isDebugEnabled())
+ {
+ log.debug("User retreived from cache for id=" + user.getId());
+ }
+
+ return user;
+ }
+
+ public Map findUserProfileById(Object id)
+ {
+ Map profile = getProfileCache().get(id);
+
+ if (profile != null && log.isDebugEnabled())
+ {
+ log.debug("User profile retreived from cache for user id=" + id);
+ }
+
+ return profile;
+ }
+
+ public Role findRoleByName(String roleName)
+ {
+ Role role = getRoleNameCache().get(roleName);
+
+ if (role != null && log.isDebugEnabled())
+ {
+ log.debug("Role retreived from cache for name=" + role.getName());
+ }
+
+ return role;
+ }
+
+ public Role findRoleById(Object id)
+ {
+ Role role = getRoleIdCache().get(id);
+
+ if (role != null && log.isDebugEnabled())
+ {
+ log.debug("Role retreived from cache for id=" + role.getId());
+ }
+
+ return role;
+ }
+
+
+}
Modified: branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/identity/service/IdentityServiceControllerImpl.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/identity/service/IdentityServiceControllerImpl.java 2008-05-21 13:27:04 UTC (rev 10791)
+++ branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/identity/service/IdentityServiceControllerImpl.java 2008-05-21 14:11:59 UTC (rev 10792)
@@ -30,16 +30,31 @@
import org.jboss.portal.identity.IdentityException;
import org.jboss.portal.identity.IdentityServiceController;
import org.jboss.portal.identity.ServiceJNDIBinder;
+import org.jboss.portal.identity.UserModule;
+import org.jboss.portal.identity.UserProfileModule;
+import org.jboss.portal.identity.DelegatingUserProfileModuleImpl;
+import org.jboss.portal.identity.RoleModule;
+import org.jboss.portal.identity.ldap.LDAPUserModule;
+import org.jboss.portal.identity.ldap.LDAPUserProfileModule;
+import org.jboss.portal.identity.ldap.LDAPRoleModule;
import org.jboss.portal.identity.boot.IdentityServiceLoader;
import org.jboss.portal.identity.event.IdentityEvent;
import org.jboss.portal.identity.event.IdentityEventBroadcaster;
import org.jboss.portal.identity.metadata.service.IdentityServicesMetaData;
+import org.jboss.portal.identity.metadata.service.ModuleServiceMetaData;
+import org.jboss.portal.identity.metadata.config.ModuleMetaData;
import org.jboss.portal.identity.service.IdentityConfigurationService;
+import org.jboss.portal.identity.service.UserProfileModuleService;
import org.jboss.portal.jems.as.JNDI;
import org.jboss.portal.jems.as.system.AbstractJBossService;
import org.jboss.portal.jems.as.system.JBossServiceModelMBean;
+import org.jboss.portal.core.identity.cache.CachedLDAPUserModuleWrapper;
+import org.jboss.portal.core.identity.cache.IdentityCacheService;
+import org.jboss.portal.core.identity.cache.CachedUserProfileModuleWrapper;
+import org.jboss.portal.core.identity.cache.CachedLDAPRoleModuleWrapper;
import javax.management.ObjectName;
+import java.util.List;
/**
* @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
@@ -64,6 +79,8 @@
private IdentityEventBroadcaster identityEventBroadcaster;
+ private boolean ldapIdentityCache = true;
+
/** . */
protected Kernel kernel;
@@ -154,6 +171,209 @@
serviceLoader.bootstrapModules(servicesMetaData.getModuleServices().getModulesList());
+ UserModule userModule = (UserModule)identityContext.getObject(IdentityContext.TYPE_USER_MODULE);
+
+ RoleModule roleModule = (RoleModule)identityContext.getObject(IdentityContext.TYPE_ROLE_MODULE);
+
+ UserProfileModule userProfileModule = (UserProfileModule)identityContext.getObject(IdentityContext.TYPE_USER_PROFILE_MODULE);
+
+
+ // For performance reasons we inject a wrapper around some identity modules to cache the calls. This is optional
+ // and apply only to LDAP implementation of modules. Cache is request scoped and invalidated in server interceptor
+ // IdentityCacheInterceptor
+
+ if (isLdapIdentityCache())
+ {
+ ServiceJNDIBinder binder = new SimpleServiceJNDIBinder();
+
+ IdentityCacheService cacheService = new IdentityCacheService();
+
+ binder.bind(IdentityCacheService.JNDI_NAME, cacheService);
+
+ List modules = servicesMetaData.getModuleServices().getModulesList();
+
+ if (userModule instanceof LDAPUserModule)
+ {
+ LDAPUserModule ldapUserModule = (LDAPUserModule)userModule;
+
+ // Unregister in IdentityContext
+
+ identityContext.unregister(IdentityContext.TYPE_USER_MODULE);
+
+ // Unregister in JNDI
+
+ binder.unbind(ldapUserModule.getJNDIName());
+
+ // Un/egister mbean
+
+ String serviceName = null;
+
+ // Discover serviceName for this module type
+
+ for (Object moduleData : modules)
+ {
+ ModuleServiceMetaData moduleService = (ModuleServiceMetaData)moduleData;
+ ModuleMetaData module = moduleService.getModuleData();
+
+ if (module.getType().equals(ldapUserModule.getModuleType()))
+ {
+ serviceName = module.getServiceName();
+ break;
+ }
+ }
+
+ // If we have the service name then follow with registration
+
+ if (serviceName != null)
+ {
+ // Unregister
+
+ ObjectName on = new ObjectName(serviceName);
+ if (getServer().isRegistered(on))
+ {
+ getServer().unregisterMBean(on);
+ }
+ }
+
+
+ CachedLDAPUserModuleWrapper userModuleWrapper = new CachedLDAPUserModuleWrapper((LDAPUserModule)userModule, cacheService);
+
+ // Register wrapper
+ identityContext.register(userModuleWrapper, ldapUserModule.getModuleType());
+ binder.bind(ldapUserModule.getJNDIName(), userModuleWrapper);
+
+ if (serviceName != null)
+ {
+ // Register
+
+ JBossServiceModelMBean mbean = new JBossServiceModelMBean(userModuleWrapper);
+ getServer().registerMBean(mbean, new ObjectName(serviceName));
+ }
+
+ }
+
+ if (roleModule instanceof LDAPRoleModule)
+ {
+ LDAPRoleModule ldapRoleModule = (LDAPRoleModule)roleModule;
+
+ // Unregister in IdentityContext
+
+ identityContext.unregister(IdentityContext.TYPE_ROLE_MODULE);
+
+ // Unregister in JNDI
+
+ binder.unbind(ldapRoleModule.getJNDIName());
+
+ // Un/egister mbean
+
+ String serviceName = null;
+
+ // Discover serviceName for this module type
+
+ for (Object moduleData : modules)
+ {
+ ModuleServiceMetaData moduleService = (ModuleServiceMetaData)moduleData;
+ ModuleMetaData module = moduleService.getModuleData();
+
+ if (module.getType().equals(ldapRoleModule.getModuleType()))
+ {
+ serviceName = module.getServiceName();
+ break;
+ }
+ }
+
+ // If we have the service name then follow with registration
+
+ if (serviceName != null)
+ {
+ // Unregister
+
+ ObjectName on = new ObjectName(serviceName);
+ if (getServer().isRegistered(on))
+ {
+ getServer().unregisterMBean(on);
+ }
+ }
+
+
+ CachedLDAPRoleModuleWrapper roleModuleWrapper = new CachedLDAPRoleModuleWrapper((LDAPRoleModule)roleModule, cacheService);
+
+ // Register wrapper
+ identityContext.register(roleModuleWrapper, ldapRoleModule.getModuleType());
+ binder.bind(ldapRoleModule.getJNDIName(), roleModuleWrapper);
+
+ if (serviceName != null)
+ {
+ // Register
+
+ JBossServiceModelMBean mbean = new JBossServiceModelMBean(roleModuleWrapper);
+ getServer().registerMBean(mbean, new ObjectName(serviceName));
+ }
+
+ }
+
+ if (userProfileModule instanceof LDAPUserProfileModule ||
+ userProfileModule instanceof DelegatingUserProfileModuleImpl)
+ {
+ UserProfileModuleService profileModuleService = (UserProfileModuleService)userProfileModule;
+
+ // Unregister in IdentityContext
+
+ identityContext.unregister(IdentityContext.TYPE_USER_PROFILE_MODULE);
+
+ // Unregister in JNDI
+
+ binder.unbind(profileModuleService.getJNDIName());
+
+ // Un/egister mbean
+
+ String serviceName = null;
+
+ // Discover serviceName for this module type
+
+ for (Object moduleData : modules)
+ {
+ ModuleServiceMetaData moduleService = (ModuleServiceMetaData)moduleData;
+ ModuleMetaData module = moduleService.getModuleData();
+
+ if (module.getType().equals(profileModuleService.getModuleType()))
+ {
+ serviceName = module.getServiceName();
+ break;
+ }
+ }
+
+ // If we have the service name then follow with registration
+
+ if (serviceName != null)
+ {
+ // Unregister
+
+ ObjectName on = new ObjectName(serviceName);
+ if (getServer().isRegistered(on))
+ {
+ getServer().unregisterMBean(on);
+ }
+ }
+
+ CachedUserProfileModuleWrapper userProfileModuleWrapper = new CachedUserProfileModuleWrapper(userProfileModule, cacheService);
+
+ // Register wrapper
+
+ identityContext.register(userProfileModuleWrapper, profileModuleService.getModuleType());
+ binder.bind(profileModuleService.getJNDIName(), userProfileModuleWrapper);
+
+ if (serviceName != null)
+ {
+ // Register
+
+ JBossServiceModelMBean mbean = new JBossServiceModelMBean(userProfileModuleWrapper);
+ getServer().registerMBean(mbean, new ObjectName(serviceName));
+ }
+
+ }
+ }
+
}
catch (Throwable e)
{
@@ -257,4 +477,14 @@
{
this.identityEventBroadcaster = identityEventBroadcaster;
}
+
+ public boolean isLdapIdentityCache()
+ {
+ return ldapIdentityCache;
+ }
+
+ public void setLdapIdentityCache(boolean ldapIdentityCache)
+ {
+ this.ldapIdentityCache = ldapIdentityCache;
+ }
}
Modified: branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2008-05-21 13:27:04 UTC (rev 10791)
+++ branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2008-05-21 14:11:59 UTC (rev 10792)
@@ -155,6 +155,13 @@
<xmbean/>
</mbean>
<mbean
+ code="org.jboss.portal.core.aspects.server.IdentityCacheInterceptor"
+ name="portal:service=Interceptor,type=Server,name=IdentityCache"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ </mbean>
+ <mbean
code="org.jboss.portal.server.impl.invocation.JBossInterceptorStackFactory"
name="portal:service=InterceptorStackFactory,type=Server"
xmbean-dd=""
@@ -163,6 +170,7 @@
<depends-list optional-attribute-name="InterceptorNames">
<depends-list-element>portal:service=Interceptor,type=Server,name=SessionLock</depends-list-element>
<depends-list-element>portal:service=Interceptor,type=Server,name=Transaction</depends-list-element>
+ <depends-list-element>portal:service=Interceptor,type=Server,name=IdentityCache</depends-list-element>
<depends-list-element>portal:service=Interceptor,type=Server,name=UserEvent</depends-list-element>
<depends-list-element>portal:service=Interceptor,type=Server,name=SessionInvalidator</depends-list-element>
<depends-list-element>portal:service=Interceptor,type=Server,name=User</depends-list-element>
Modified: branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/conf/login-config.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/conf/login-config.xml 2008-05-21 13:27:04 UTC (rev 10791)
+++ branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/conf/login-config.xml 2008-05-21 14:11:59 UTC (rev 10792)
@@ -33,20 +33,19 @@
</authentication>
</application-policy>
- <application-policy name="portal">
- <authentication>
+ <application-policy name="portal">
+ <authentication>
- <!--To configure LDAP support with IdentityLoginModule please check documentation on how to
- configure portal identity modules for this-->
- <login-module code="org.jboss.portal.identity.auth.IdentityLoginModule" flag="required">
- <module-option name="unauthenticatedIdentity">guest</module-option>
- <module-option name="userModuleJNDIName">java:/portal/UserModule</module-option>
- <module-option name="roleModuleJNDIName">java:/portal/RoleModule</module-option>
- <module-option name="userProfileModuleJNDIName">java:/portal/UserProfileModule</module-option>
- <module-option name="membershipModuleJNDIName">java:/portal/MembershipModule</module-option>
- <module-option name="additionalRole">Authenticated</module-option>
- <module-option name="password-stacking">useFirstPass</module-option>
- </login-module>
+ <!--To configure LDAP support with IdentityLoginModule please check documentation on how to
+ configure portal identity modules for this-->
+ <login-module code="org.jboss.portal.identity.auth.IdentityLoginModule" flag="required">
+ <module-option name="unauthenticatedIdentity">guest</module-option>
+ <module-option name="userModuleJNDIName">java:/portal/UserModule</module-option>
+ <module-option name="roleModuleJNDIName">java:/portal/RoleModule</module-option>
+ <module-option name="userProfileModuleJNDIName">java:/portal/UserProfileModule</module-option>
+ <module-option name="membershipModuleJNDIName">java:/portal/MembershipModule</module-option>
+ <module-option name="additionalRole">Authenticated</module-option>
+ </login-module>
<!--Use can use this module instead of IdentityLoginModule to bind to LDAP. It simply extends JBossSX LdapExtLoginModule so
all configuration that can be applied to LdapExtLoginModule also can be applied here. For user that
17 years, 11 months
JBoss Portal SVN: r10791 - modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2008-05-21 09:27:04 -0400 (Wed, 21 May 2008)
New Revision: 10791
Modified:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPRoleModule.java
Log:
Small API change to be able to wrap this object
Modified: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPRoleModule.java
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPRoleModule.java 2008-05-21 08:46:06 UTC (rev 10790)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPRoleModule.java 2008-05-21 13:27:04 UTC (rev 10791)
@@ -104,7 +104,7 @@
- protected LDAPRoleImpl createRoleInstance(Attributes attrs, String dn) throws IdentityException
+ public LDAPRoleImpl createRoleInstance(Attributes attrs, String dn) throws IdentityException
{
LDAPRoleImpl ldapr = null;
try
17 years, 11 months
JBoss Portal SVN: r10790 - in branches/JBoss_Portal_Branch_2_7: core/src/resources/portal-core-war/WEB-INF and 11 other directories.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-05-21 04:46:06 -0400 (Wed, 21 May 2008)
New Revision: 10790
Added:
branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/UserPortletConstants.java
branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/catalog/
branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/catalog/CatalogPortlet.java
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/jboss-portlet.xml
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/jsp/
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/jsp/catalog/
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/portal-lib.tld
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/portlet-instances.xml
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/portlet.xml
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/web.xml
Removed:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/ui/portlet/catalog/
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/ui/portlet/role/
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/ui/portlet/user/
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/jsp/catalog/
Modified:
branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/ui/faces/components/StaticValues.java
branches/JBoss_Portal_Branch_2_7/core-samples/.classpath
branches/JBoss_Portal_Branch_2_7/core-samples/build.xml
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet.xml
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/portlet-instances.xml
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/portlet.xml
Log:
- Removed obsolete User and Role portlets
- Move Catalog portlet in core-samples
Modified: branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml 2008-05-21 07:02:16 UTC (rev 10789)
+++ branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml 2008-05-21 08:46:06 UTC (rev 10790)
@@ -27,50 +27,6 @@
<portlet-app>
<portlet>
- <portlet-name>UserPortlet</portlet-name>
- <transaction>
- <trans-attribute>Required</trans-attribute>
- </transaction>
- <portlet-info>
- <icon>
- <small-icon>/images/portletIcon_Users.gif</small-icon>
- <large-icon>/images/portletIcon_Users.gif</large-icon>
- </icon>
- </portlet-info>
- </portlet>
- <portlet>
- <portlet-name>RolePortlet</portlet-name>
- <transaction>
- <trans-attribute>Required</trans-attribute>
- </transaction>
- <header-content>
- <script type="text/javascript" language="javascript">
- function hideShow(id)
- {
- var navpoint = document.getElementById(id);
- if (navpoint.className == 'hidden') {
- navpoint.className = 'shown';
- } else {
- navpoint.className = 'hidden';
- }
- }
- </script>
- </header-content>
- <portlet-info>
- <icon>
- <small-icon>/images/portletIcon_Users.gif</small-icon>
- <large-icon>/images/portletIcon_Users.gif</large-icon>
- </icon>
- </portlet-info>
- </portlet>
-
- <portlet>
- <portlet-name>CatalogPortlet</portlet-name>
- <transaction>
- <trans-attribute>Required</trans-attribute>
- </transaction>
- </portlet>
- <portlet>
<portlet-name>PortletContentEditorPortlet</portlet-name>
<transaction>
<trans-attribute>RequiresNew</trans-attribute>
Modified: branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/portlet-instances.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/portlet-instances.xml 2008-05-21 07:02:16 UTC (rev 10789)
+++ branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/portlet-instances.xml 2008-05-21 08:46:06 UTC (rev 10790)
@@ -29,30 +29,6 @@
<deployments>
<deployment>
<instance>
- <display-name xml:lang="en">User portlet</display-name>
- <display-name xml:lang="fr">Portlet utilisateur</display-name>
- <instance-id>UserPortletInstance</instance-id>
- <portlet-ref>UserPortlet</portlet-ref>
- </instance>
- </deployment>
- <deployment>
- <instance>
- <display-name xml:lang="en">Role portlet</display-name>
- <display-name xml:lang="fr">Portlet role</display-name>
- <instance-id>RolePortletInstance</instance-id>
- <portlet-ref>RolePortlet</portlet-ref>
- </instance>
- </deployment>
- <deployment>
- <instance>
- <display-name xml:lang="en">Catalog portlet</display-name>
- <display-name xml:lang="fr">Portlet catalogue</display-name>
- <instance-id>CatalogPortletInstance</instance-id>
- <portlet-ref>CatalogPortlet</portlet-ref>
- </instance>
- </deployment>
- <deployment>
- <instance>
<instance-id>PortletContentEditorInstance</instance-id>
<portlet-ref>PortletContentEditorPortlet</portlet-ref>
<security-constraint>
Modified: branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/portlet.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/portlet.xml 2008-05-21 07:02:16 UTC (rev 10789)
+++ branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/portlet.xml 2008-05-21 08:46:06 UTC (rev 10790)
@@ -28,89 +28,6 @@
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
version="2.0">
<portlet>
- <description>Portlet providing user login/logout and profile management</description>
- <portlet-name>UserPortlet</portlet-name>
- <display-name>User Portlet</display-name>
- <portlet-class>org.jboss.portal.core.ui.portlet.user.UserPortlet</portlet-class>
- <init-param>
- <description>Whether we should use ssl on login and throughout the Portal. 1=yes;0=no</description>
- <name>useSSL</name>
- <value>0</value>
- </init-param>
- <init-param>
- <description>Subscription mode</description>
- <name>subscriptionMode</name>
- <value>automatic</value>
- <!--
- <value>emailVerification</value>
- -->
- </init-param>
- <init-param>
- <description>Domain of your website for email verification.</description>
- <name>emailDomain</name>
- <value>JBoss.com</value>
- </init-param>
- <init-param>
- <description>Email displayed in the TO field</description>
- <name>emailFrom</name>
- <value>jbossportal(a)example.com</value>
- </init-param>
- <init-param>
- <description>Default role of registered users</description>
- <name>defaultRole</name>
- <value>User</value>
- </init-param>
- <supports>
- <mime-type>text/html</mime-type>
- <portlet-mode>VIEW</portlet-mode>
- </supports>
- <supported-locale>en</supported-locale>
- <supported-locale>fr</supported-locale>
- <supported-locale>es</supported-locale>
- <resource-bundle>Resource</resource-bundle>
- <portlet-info>
- <title>User portlet</title>
- <keywords>management,admin</keywords>
- </portlet-info>
- <security-role-ref>
- <role-name>Admin</role-name>
- </security-role-ref>
- </portlet>
- <portlet>
- <description>Portlet for managing user roles</description>
- <portlet-name>RolePortlet</portlet-name>
- <display-name>User Roles Portlet</display-name>
- <portlet-class>org.jboss.portal.core.ui.portlet.role.RolePortlet</portlet-class>
- <supports>
- <mime-type>text/html</mime-type>
- <portlet-mode>VIEW</portlet-mode>
- </supports>
- <supported-locale>en</supported-locale>
- <supported-locale>fr</supported-locale>
- <supported-locale>es</supported-locale>
- <resource-bundle>Resource</resource-bundle>
- <portlet-info>
- <title>Role management</title>
- <keywords>management,admin</keywords>
- </portlet-info>
- <security-role-ref>
- <role-name>Admin</role-name>
- </security-role-ref>
- </portlet>
- <portlet>
- <description>Portlet providing navigable list of portal pages</description>
- <portlet-name>CatalogPortlet</portlet-name>
- <display-name>Portal Pages Catalog Portlet</display-name>
- <portlet-class>org.jboss.portal.core.ui.portlet.catalog.CatalogPortlet</portlet-class>
- <supports>
- <mime-type>text/html</mime-type>
- <portlet-mode>VIEW</portlet-mode>
- </supports>
- <portlet-info>
- <title>Catalog</title>
- </portlet-info>
- </portlet>
- <portlet>
<description>Portlet Content Editor</description>
<portlet-name>PortletContentEditorPortlet</portlet-name>
<display-name>Portlet Content Editor</display-name>
Copied: branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/UserPortletConstants.java (from rev 10789, branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/ui/portlet/user/UserPortletConstants.java)
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/UserPortletConstants.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/UserPortletConstants.java 2008-05-21 08:46:06 UTC (rev 10790)
@@ -0,0 +1,119 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, 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. *
+ ******************************************************************************/
+package org.jboss.portal.core.identity;
+
+/** @author <a href="theute(a)jboss.org">Thomas Heute</a> $Revision$ */
+public class UserPortletConstants
+{
+
+ public static final String SALT = "14m1r0nm4n";
+
+ public static final String INFOMESSAGE = "infomessage";
+ public static final String ERRORMESSAGE = "errormessage";
+
+ // Cookie names
+ public static String CK_USERNAME = "username";
+ public static String CK_PASS = "password";
+
+ // Default values
+ public static int DEFAULT_USERSPERPAGE = 10;
+
+ // Status return codes for the login.
+ public static final int LOGIN_STATUS_OK = 0;
+ public static final int LOGIN_STATUS_BAD_PASSWORD = 1;
+ public static final int LOGIN_STATUS_NO_SUCH_USER = 2;
+ public static final int LOGIN_STATUS_USER_DISABLED = 3;
+ public static final int LOGIN_STATUS_INVALID_NAME = 4;
+ public static final int LOGIN_STATUS_UNEXPECTED_ERROR = 5;
+
+ public static final int PERMANENT_USER_MAX_INACTIVE = 60 * 60 * 24 * 5 * 1000; // 5 days in ms
+ public static final int TRANSIENT_USER_MAX_INACTIVE = 60 * 60; // 1 hours in seconds
+
+ public static final String HASH = "hash";
+ public static final String USERID = "userid";
+
+ // Portlet configuration
+
+ public static final String EMAILFROM = "emailFrom";
+ public static final String SUBSCRIPTIONMODE = "subscriptionMode";
+ public static final String SUBSCRIPTIONMODE_AUTOMATIC = "automatic";
+ public static final String SUBSCRIPTIONMODE_EMAILVERIFICATION = "emailVerification";
+ public static final String DEFAULT_ROLE = "defaultRole";
+
+ /** Timezone information : ((value + 1) * 2) - 1 = 2 * value + 1 */
+ public static final String[] TIME_ZONE_OFFSETS =
+ {
+ "(GMT -12:00 hours) Eniwetok, Kwajalein",
+ null,
+ "(GMT -11:00 hours) Midway Island, Samoa",
+ null,
+ "(GMT -10:00 hours) Hawaii",
+ null,
+ "(GMT -9:00 hours) Alaska",
+ null,
+ "(GMT -8:00 hours) Pacific Time (US & Canada)",
+ null,
+ "(GMT -7:00 hours) Mountain Time (US & Canada)",
+ null,
+ "(GMT -6:00 hours) Central Time (US & Canada), Mexico City",
+ null,
+ "(GMT -5:00 hours) Eastern Time (US & Canada), Bogota, Lima, Quito",
+ null,
+ "(GMT -4:00 hours) Atlantic Time (Canada), Caracas, La Paz",
+ "(GMT -3:30 hours) Newfoundland",
+ "(GMT -3:00 hours) Brazil, Buenos Aires, Georgetown",
+ null,
+ "(GMT -2:00 hours) Mid-Atlantic",
+ null,
+ "(GMT -1:00 hours) Azores, Cape Verde Islands",
+ null,
+ "(GMT) Western Europe Time, London, Lisbon, Casablanca, Monrovia",
+ null,
+ "(GMT +1:00 hours) CET(Central Europe Time), Brussels, Copenhagen, Madrid, Paris",
+ null,
+ "(GMT +2:00 hours) EET(Eastern Europe Time), Kaliningrad, South Africa",
+ null,
+ "(GMT +3:00 hours) Baghdad, Kuwait, Riyadh, Moscow, St. Petersburg",
+ "(GMT +3:30 hours) Tehran",
+ "(GMT +4:00 hours) Abu Dhabi, Muscat, Baku, Tbilisi",
+ "(GMT +4:30 hours) Kabul",
+ "(GMT +5:00 hours) Ekaterinburg, Islamabad, Karachi, Tashkent",
+ "(GMT +5:30 hours) Bombay, Calcutta, Madras, New Delhi",
+ "(GMT +6:00 hours) Almaty, Dhaka, Colombo",
+ null,
+ "(GMT +7:00 hours) Bangkok, Hanoi, Jakarta",
+ null,
+ "(GMT +8:00 hours) Beijing, Perth, Singapore, Hong Kong, Chongqing, Urumqi, Taipei",
+ null,
+ "(GMT +9:00 hours) Tokyo, Seoul, Osaka, Sapporo, Yakutsk",
+ "(GMT +9:30 hours) Adelaide, Darwin",
+ "(GMT +10:00 hours) EAST(East Australian Standard)",
+ null,
+ "(GMT +11:00 hours) Magadan, Solomon Islands, New Caledonia",
+ null,
+ "(GMT +12:00 hours) Auckland, Wellington, Fiji, Kamchatka, Marshall Island",
+ null
+ };
+
+ public static final String DEFAULT_IMAGES_PATH = "images/user";
+}
Modified: branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/ui/faces/components/StaticValues.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/ui/faces/components/StaticValues.java 2008-05-21 07:02:16 UTC (rev 10789)
+++ branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/ui/faces/components/StaticValues.java 2008-05-21 08:46:06 UTC (rev 10790)
@@ -34,7 +34,7 @@
import javax.portlet.PortletContext;
import org.jboss.portal.common.i18n.LocaleManager;
-import org.jboss.portal.core.ui.portlet.user.UserPortletConstants;
+import org.jboss.portal.core.identity.UserPortletConstants;
import org.jboss.portal.theme.PortalTheme;
import org.jboss.portal.theme.ThemeInfo;
import org.jboss.portal.theme.ThemeService;
Modified: branches/JBoss_Portal_Branch_2_7/core-samples/.classpath
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/.classpath 2008-05-21 07:02:16 UTC (rev 10789)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/.classpath 2008-05-21 08:46:06 UTC (rev 10790)
@@ -16,5 +16,6 @@
<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/portlet/lib/portal-portlet-lib.jar"/>
<classpathentry kind="lib" path="/thirdparty/sun-servlet/lib/servlet-api.jar"/>
<classpathentry kind="lib" path="/thirdparty/portlet/lib/portlet-api.jar"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/security"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: branches/JBoss_Portal_Branch_2_7/core-samples/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/build.xml 2008-05-21 07:02:16 UTC (rev 10789)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/build.xml 2008-05-21 08:46:06 UTC (rev 10790)
@@ -126,6 +126,7 @@
<path refid="jboss.portal-core.classpath"/>
<path refid="jboss.portal-format.classpath"/>
<path refid="jboss.portal-api.classpath"/>
+ <path refid="jboss.portal-security.classpath"/>
</path>
<!--+=======================================+-->
@@ -219,6 +220,15 @@
<fileset dir="${build.classes}" includes="org/jboss/portal/core/samples/jsp/**"/>
</jar>
+ <!-- portal-catalog-samples.war -->
+ <copy todir="${build.resources}/portal-catalog-samples.war">
+ <fileset dir="${build.resources}/portal-catalog-samples-war"/>
+ </copy>
+ <mkdir dir="${build.resources}/portal-catalog-samples.war/WEB-INF/lib/"/>
+ <jar jarfile="${build.resources}/portal-catalog-samples.war/WEB-INF/lib/portal-catalog-samples-lib.jar">
+ <fileset dir="${build.classes}" includes="org/jboss/portal/core/samples/catalog/**"/>
+ </jar>
+
<!-- portal-news-samples.war -->
<copy todir="${build.resources}/portal-news-samples.war">
<fileset dir="${source.bin}/portal-news-samples-war"/>
@@ -272,6 +282,9 @@
dir="${build.resources}/portal-jsp-samples.war"
tofile="${build.lib}/portal-jsp-samples.war"/>
<implode
+ dir="${build.resources}/portal-catalog-samples.war"
+ tofile="${build.lib}/portal-catalog-samples.war"/>
+ <implode
dir="${build.resources}/portal-news-samples.war"
tofile="${build.lib}/portal-news-samples.war"/>
<implode
@@ -333,6 +346,8 @@
overwrite="true"/>
<copy file="${build.lib}/portal-jsp-samples.war" todir="${jboss.home}/server/${portal.deploy.dir}"
overwrite="true"/>
+ <copy file="${build.lib}/portal-catalog-samples.war" todir="${jboss.home}/server/${portal.deploy.dir}"
+ overwrite="true"/>
<copy file="${build.lib}/portal-news-samples.war" todir="${jboss.home}/server/${portal.deploy.dir}"
overwrite="true"/>
<copy file="${build.lib}/portal-weather-samples.war" todir="${jboss.home}/server/${portal.deploy.dir}"
@@ -349,9 +364,10 @@
<target name="undeploy"
description="Undeploy."
depends="init">
- <require file="${jboss.home}/server/${portal.deploy.dir}"/>
- <delete file="${jboss.home}/server/${portal.deploy.dir}/portal-basic-samples.sar"/>
+ <require file="${jboss.home}/server/${portal.deploy.dir}"/>
+ <delete file="${jboss.home}/server/${portal.deploy.dir}/portal-basic-samples.sar"/>
<delete file="${jboss.home}/server/${portal.deploy.dir}/portal-jsp-samples.war"/>
+ <delete file="${jboss.home}/server/${portal.deploy.dir}/portal-catalog-samples.war"/>
<delete file="${jboss.home}/server/${portal.deploy.dir}/portal-news-samples.war"/>
<delete file="${jboss.home}/server/${portal.deploy.dir}/portal-weather-samples.war"/>
<delete file="${jboss.home}/server/${portal.deploy.dir}/portal-users-samples.sar"/>
Copied: branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/catalog/CatalogPortlet.java (from rev 10779, branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/ui/portlet/catalog/CatalogPortlet.java)
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/catalog/CatalogPortlet.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/catalog/CatalogPortlet.java 2008-05-21 08:46:06 UTC (rev 10790)
@@ -0,0 +1,201 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, 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. *
+ ******************************************************************************/
+package org.jboss.portal.core.samples.catalog;
+
+import org.jboss.portal.api.node.PortalNode;
+import org.jboss.portal.api.node.PortalNodeURL;
+import org.jboss.portal.core.impl.api.node.PortalNodeImpl;
+import org.jboss.portal.core.model.portal.PortalObjectPermission;
+import org.jboss.portal.security.spi.auth.PortalAuthorizationManagerFactory;
+import org.jboss.portlet.JBossPortlet;
+import org.jboss.portlet.JBossRenderRequest;
+import org.jboss.portlet.JBossRenderResponse;
+
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class CatalogPortlet
+ extends JBossPortlet
+{
+ /** . */
+ private static final String RESOURCE_PREFIX = "PAGENAME_";
+
+ private PortalAuthorizationManagerFactory portalAuthorizationManagerFactory;
+
+ public void init() throws PortletException
+ {
+ portalAuthorizationManagerFactory = (PortalAuthorizationManagerFactory)getPortletContext().getAttribute("PortalAuthorizationManagerFactory");
+
+ if (portalAuthorizationManagerFactory == null)
+ {
+ throw new PortletException("No portal authorization manager factory");
+ }
+ }
+
+ public void destroy()
+ {
+ super.destroy();
+
+ portalAuthorizationManagerFactory = null;
+ }
+
+ public void render(JBossRenderRequest req, JBossRenderResponse resp) throws IOException
+ {
+ resp.setContentType("text/html");
+
+ PortalNode current = req.getPortalNode();
+// WindowState ws = req.getWindowState();
+// if(WindowState.MAXIMIZED.equals(ws))
+// {
+// resp.setTitle("Sitemap");
+// PortalNode parent = current.getParent();
+// req.setAttribute("parentNode", parent);
+// try
+// {
+// PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/catalog/sitemap.jsp");
+// prd.include(req, resp);
+// }
+// catch(Exception e)
+// {
+// e.printStackTrace();
+// }
+// }
+// else
+// {
+ resp.setTitle("Pages");
+ PortalNode parent = current.getParent();
+
+ HashMap parentsMap = new HashMap();
+ PortalNode node = parent.getParent();
+ while (node.getType() != PortalNode.TYPE_PORTAL)
+ {
+ parentsMap.put(localize(req.getLocale(), node.getName()), resp.createRenderURL(node));
+ node = node.getParent();
+ }
+ req.setAttribute("parents", parentsMap);
+
+ try
+ {
+ req.setAttribute("parentNode", localize(req.getLocale(), parent.getName()));
+
+ HashMap parentChildMap = new HashMap();
+ HashMap parentSiblingMap = new HashMap();
+ for (Iterator i = parent.getParent().getChildren().iterator(); i.hasNext();)
+ {
+ PortalNode parentSibling = (PortalNode)i.next();
+
+ // Display only sibling pages
+ if (parentSibling.getType() == PortalNode.TYPE_PAGE)
+ {
+ if (parentSibling.equals(parent))
+ {
+ for (Iterator j = parent.getChildren().iterator(); j.hasNext();)
+ {
+ PortalNode child = (PortalNode)j.next();
+ if (child.getType() == PortalNode.TYPE_PAGE)
+ {
+ boolean allowed = false;
+ // check if the current user is allowed to access this page
+ if (child instanceof PortalNodeImpl)
+ {
+ PortalNodeImpl pn = (PortalNodeImpl)child;
+ PortalObjectPermission perm = new PortalObjectPermission(pn.getObjectId(), PortalObjectPermission.VIEW_MASK);
+ if (portalAuthorizationManagerFactory.getManager().checkPermission(perm))
+ {
+ allowed = true;
+ }
+ else
+ {
+ allowed = false;
+ }
+ }
+ if (allowed)
+ {
+ PortalNodeURL childURL = resp.createRenderURL(child);
+ parentChildMap.put(localize(req.getLocale(), child.getName()), childURL);
+ }
+ }
+ }
+ }
+ else
+ {
+ boolean allowed = false;
+ // check if the current user is allowed to access this page
+ if (parentSibling instanceof PortalNodeImpl)
+ {
+ PortalNodeImpl pn = (PortalNodeImpl)parentSibling;
+ PortalObjectPermission perm = new PortalObjectPermission(pn.getObjectId(), PortalObjectPermission.VIEW_MASK);
+ if (portalAuthorizationManagerFactory.getManager().checkPermission(perm))
+ {
+ allowed = true;
+ }
+ else
+ {
+ allowed = false;
+ }
+ }
+ if (allowed)
+ {
+ PortalNodeURL parentSiblingURL = resp.createRenderURL(parentSibling);
+ parentSiblingMap.put(localize(req.getLocale(), parentSibling.getName()), parentSiblingURL);
+ }
+ }
+ }
+ }
+ req.setAttribute("pchild", parentChildMap);
+ req.setAttribute("psib", parentSiblingMap);
+
+ PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/catalog/index.jsp");
+ prd.include(req, resp);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+// }
+ }
+
+ private String localize(Locale locale, String name)
+ {
+ try
+ {
+ ResourceBundle rb = ResourceBundle.getBundle("conf.bundles.Resource", locale, Thread.currentThread().getContextClassLoader());
+ name = rb.getString(RESOURCE_PREFIX + name);
+ }
+ catch (MissingResourceException e)
+ {
+ }
+ return name;
+ }
+}
Modified: branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet.xml 2008-05-21 07:02:16 UTC (rev 10789)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet.xml 2008-05-21 08:46:06 UTC (rev 10790)
@@ -26,6 +26,20 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
version="2.0">
+
+ <filter>
+ <filter-name>JBoss Portlet Filter</filter-name>
+ <filter-class>org.jboss.portlet.filter.JBossPortletFilter</filter-class>
+ <lifecycle>ACTION_PHASE</lifecycle>
+ <lifecycle>RENDER_PHASE</lifecycle>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>JBoss Portlet Filter</filter-name>
+ <portlet-name>TestPortlet</portlet-name>
+ <portlet-name>ModePortlet</portlet-name>
+ </filter-mapping>
+
<portlet>
<description>Mode Portlet</description>
<portlet-name>ModePortlet</portlet-name>
Added: branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/jboss-portlet.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/jboss-portlet.xml (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/jboss-portlet.xml 2008-05-21 08:46:06 UTC (rev 10790)
@@ -0,0 +1,42 @@
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE portlet-app PUBLIC
+ "-//JBoss Portal//DTD JBoss Portlet 2.6//EN"
+ "http://www.jboss.org/portal/dtd/jboss-portlet_2_6.dtd">
+
+<portlet-app>
+ <portlet>
+ <portlet-name>CatalogPortlet</portlet-name>
+ <transaction>
+ <trans-attribute>Required</trans-attribute>
+ </transaction>
+ </portlet>
+
+ <service>
+ <service-name>PortalAuthorizationManagerFactory</service-name>
+ <service-class>org.jboss.portal.security.spi.auth.PortalAuthorizationManagerFactory</service-class>
+ <service-ref>:service=PortalAuthorizationManagerFactory</service-ref>
+ </service>
+
+</portlet-app>
\ No newline at end of file
Copied: branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/jsp/catalog (from rev 10779, branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/jsp/catalog)
Added: branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/portal-lib.tld
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/portal-lib.tld (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/portal-lib.tld 2008-05-21 08:46:06 UTC (rev 10790)
@@ -0,0 +1,104 @@
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
+ version="2.0">
+ <tlib-version>1.1</tlib-version>
+ <short-name>JBoss-Portal-tags</short-name>
+
+ <tag>
+ <name>if</name>
+ <tag-class>org.jboss.portal.core.servlet.jsp.taglib.IfTag</tag-class>
+ <body-content>JSP</body-content>
+ <attribute>
+ <name>ctx</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>iterate</name>
+ <tag-class>org.jboss.portal.core.servlet.jsp.taglib.IterateTag</tag-class>
+ <body-content>JSP</body-content>
+ <attribute>
+ <name>ctx</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>include</name>
+ <tag-class>org.jboss.portal.core.servlet.jsp.taglib.IncludeTag</tag-class>
+ <body-content>JSP</body-content>
+ <attribute>
+ <name>page</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>error</name>
+ <tag-class>org.jboss.portal.core.servlet.jsp.taglib.ErrorTag</tag-class>
+ <body-content>JSP</body-content>
+ <attribute>
+ <name>key</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>errors</name>
+ <tag-class>org.jboss.portal.core.servlet.jsp.taglib.ErrorsTag</tag-class>
+ <body-content>JSP</body-content>
+ </tag>
+
+ <tag>
+ <name>success</name>
+ <tag-class>org.jboss.portal.core.servlet.jsp.taglib.SuccessTag</tag-class>
+ <body-content>JSP</body-content>
+ </tag>
+ <function>
+ <name>i18n</name>
+ <function-class>org.jboss.portal.core.servlet.jsp.taglib.PortalLib</function-class>
+ <function-signature>java.lang.String getMessage(java.lang.String)</function-signature>
+ </function>
+
+ <function>
+ <name>out</name>
+ <function-class>org.jboss.portal.core.servlet.jsp.taglib.PortalLib</function-class>
+ <function-signature>java.lang.String out(java.lang.String)</function-signature>
+ </function>
+
+ <function>
+ <name>i18nout</name>
+ <function-class>org.jboss.portal.core.servlet.jsp.taglib.PortalLib</function-class>
+ <function-signature>java.lang.String i18nOut(java.lang.String)</function-signature>
+ </function>
+
+</taglib>
Added: branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/portlet-instances.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/portlet-instances.xml (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/portlet-instances.xml 2008-05-21 08:46:06 UTC (rev 10790)
@@ -0,0 +1,38 @@
+<?xml version="1.0" standalone="yes"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE deployments PUBLIC
+ "-//JBoss Portal//DTD Portlet Instances 2.6//EN"
+ "http://www.jboss.org/portal/dtd/portlet-instances_2_6.dtd">
+
+<deployments>
+ <deployment>
+ <instance>
+ <display-name xml:lang="en">Catalog portlet</display-name>
+ <display-name xml:lang="fr">Portlet catalogue</display-name>
+ <instance-id>CatalogPortletInstance</instance-id>
+ <portlet-ref>CatalogPortlet</portlet-ref>
+ </instance>
+ </deployment>
+</deployments>
\ No newline at end of file
Added: branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/portlet.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/portlet.xml (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/portlet.xml 2008-05-21 08:46:06 UTC (rev 10790)
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<portlet-app
+ xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ version="2.0">
+
+ <filter>
+ <filter-name>JBoss Portlet Filter</filter-name>
+ <filter-class>org.jboss.portlet.filter.JBossPortletFilter</filter-class>
+ <lifecycle>ACTION_PHASE</lifecycle>
+ <lifecycle>RENDER_PHASE</lifecycle>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>JBoss Portlet Filter</filter-name>
+ <portlet-name>CatalogPortlet</portlet-name>
+ </filter-mapping>
+
+ <portlet>
+ <description>Portlet providing navigable list of portal pages</description>
+ <portlet-name>CatalogPortlet</portlet-name>
+ <display-name>Portal Pages Catalog Portlet</display-name>
+ <portlet-class>org.jboss.portal.core.samples.catalog.CatalogPortlet</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ </supports>
+ <portlet-info>
+ <title>Catalog</title>
+ </portlet-info>
+ </portlet>
+ </portlet-app>
Added: branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/web.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/web.xml (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/web.xml 2008-05-21 08:46:06 UTC (rev 10790)
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app>
+</web-app>
Property changes on: branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/web.xml
___________________________________________________________________
Name: svn:executable
+ *
17 years, 11 months
JBoss Portal SVN: r10789 - branches/JBoss_Portal_Branch_2_7/core.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-05-21 03:02:16 -0400 (Wed, 21 May 2008)
New Revision: 10789
Modified:
branches/JBoss_Portal_Branch_2_7/core/build.xml
Log:
Oups
Modified: branches/JBoss_Portal_Branch_2_7/core/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/build.xml 2008-05-20 23:05:27 UTC (rev 10788)
+++ branches/JBoss_Portal_Branch_2_7/core/build.xml 2008-05-21 07:02:16 UTC (rev 10789)
@@ -129,7 +129,6 @@
<!-- Configure modules -->
<call target="configure-modules"/>
<path id="dependentmodule.classpath">
- <path refid="jboss.portal-format.classpath"/>
<path refid="jboss.portal-server.classpath"/>
<path refid="jboss.portal-registration.classpath"/>
<path refid="jboss.portal-portlet-server.classpath"/>
@@ -318,7 +317,6 @@
<copy todir="${build.resources}/jboss-portal/lib">
<fileset dir="${build.lib}" includes="portal-core-lib.jar"/>
<fileset dir="${build.lib}" includes="jboss-portlet-api-lib.jar"/>
- <fileset dir="${jboss.portal-format.root}/lib" includes="portal-format-lib.jar"/>
<fileset dir="${jboss.portal/modules/common.lib}"
includes="portal-common-lib.jar,portal-common-portal-lib.jar"/>
<fileset dir="${jboss.portal/modules/web.lib}" includes="portal-web-lib.jar"/>
17 years, 11 months
JBoss Portal SVN: r10788 - in branches/JBoss_Portal_Branch_2_7: core/src/resources/portal-core-war/WEB-INF/jsp/content and 3 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-05-20 19:05:27 -0400 (Tue, 20 May 2008)
New Revision: 10788
Modified:
branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/WindowComparator.java
branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/common/PageManagerBean.java
branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/jsf/common/editPageLayout.xhtml
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/ui/content/portlet/PortletContentEditorPortlet.java
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/jsp/content/portlet_editor.jsp
Log:
- Content integration:
+ Use content.uri again (not sure why it was changed)
+ Add namespace bound variable so that it can be accessed from JSF
+ Check the event name (though it doesn't seem to be properly called)
+ Use namespace in javascript in editPageLayout (there seems to be discrepancies with JSF and namespacing)... :(
- Generification
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/ui/content/portlet/PortletContentEditorPortlet.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/ui/content/portlet/PortletContentEditorPortlet.java 2008-05-20 22:12:48 UTC (rev 10787)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/ui/content/portlet/PortletContentEditorPortlet.java 2008-05-20 23:05:27 UTC (rev 10788)
@@ -40,7 +40,6 @@
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import javax.xml.namespace.QName;
-
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
@@ -65,6 +64,8 @@
/** . */
private InstanceContainer instanceContainer;
+ private static final QName CONTENT_SELECT = new QName("urn:jboss:portal:content", "select");
+ private static final String CONTENT_URI = "content.uri";
public void init() throws PortletException
{
@@ -75,11 +76,11 @@
{
if ((req.getPortletMode().equals(EDIT_CONTENT)))
{
- String uri = req.getParameter("content_uri");
+ String uri = req.getParameter(CONTENT_URI);
if (uri != null)
{
- resp.setRenderParameter("content_uri", uri);
- resp.setEvent(new QName("urn:jboss:portal:content", "select"), uri);
+ resp.setRenderParameter(CONTENT_URI, uri);
+ resp.setEvent(CONTENT_SELECT, uri);
}
}
}
@@ -103,7 +104,7 @@
protected void getContent(RenderRequest req, RenderResponse resp, boolean newContent) throws PortletException, PortletSecurityException, IOException
{
- String selectedURI = req.getParameter("content_uri");
+ String selectedURI = req.getParameter(CONTENT_URI);
//
resp.setContentType("text/html");
Modified: branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/jsp/content/portlet_editor.jsp
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/jsp/content/portlet_editor.jsp 2008-05-20 22:12:48 UTC (rev 10787)
+++ branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/jsp/content/portlet_editor.jsp 2008-05-20 23:05:27 UTC (rev 10788)
@@ -133,7 +133,7 @@
%>
<portlet:actionURL var="url">
<portlet:param name="content.action.select" value="true"/>
- <portlet:param name="content_uri" value="<%= instance.getId() %>"/>
+ <portlet:param name="content.uri" value="<%= instance.getId() %>"/>
</portlet:actionURL>
<div style="display:none">
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/WindowComparator.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/WindowComparator.java 2008-05-20 22:12:48 UTC (rev 10787)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/WindowComparator.java 2008-05-20 23:05:27 UTC (rev 10788)
@@ -31,13 +31,11 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
-public class WindowComparator implements Comparator
+public class WindowComparator implements Comparator<Window>
{
- public int compare(Object o1, Object o2)
+ public int compare(Window w1, Window w2)
{
- Window w1 = (Window)o1;
- Window w2 = (Window)o2;
int sign = getOrder(w1) - getOrder(w2);
if (sign == 0)
{
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/common/PageManagerBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/common/PageManagerBean.java 2008-05-20 22:12:48 UTC (rev 10787)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/common/PageManagerBean.java 2008-05-20 23:05:27 UTC (rev 10788)
@@ -50,7 +50,9 @@
import javax.faces.event.AbortProcessingException;
import javax.faces.event.ActionEvent;
import javax.faces.model.SelectItem;
+import javax.xml.namespace.QName;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
@@ -80,6 +82,8 @@
/** . */
private static final int CONTENT_PARAM_PREFIX_LENGTH = CONTENT_PARAM_PREFIX.length();
+ private static final QName CONTENT_SELECT = new QName("urn:jboss:portal:content", "select");
+
/** . */
private static final int MOVE_UP = 'u';
@@ -91,6 +95,7 @@
/** . */
private static final int ADD_ACTION = 'a';
+ private static final String VIEW_ROOT = ":_viewRoot";
public PageManagerBean(LayoutService layoutService, PortletInvoker portletInvoker)
{
@@ -124,12 +129,17 @@
/** . */
public Map selectedRenderParameters;
+ public String getNamespace()
+ {
+ return FacesContext.getCurrentInstance().getExternalContext().encodeNamespace("") + VIEW_ROOT;
+ }
+
public List getContentTypeItems()
- {
- LinkedList types = new LinkedList();
- for (Iterator i = ContentProviderRegistryService.getInstance().getContentTypes().iterator(); i.hasNext();)
+ {
+ LinkedList<SelectItem> types = new LinkedList<SelectItem>();
+ for (Object o : ContentProviderRegistryService.getInstance().getContentTypes())
{
- ContentType contentType = (ContentType)i.next();
+ ContentType contentType = (ContentType)o;
SelectItem item = new SelectItem();
item.setValue(contentType);
item.setLabel(contentType.toString());
@@ -147,7 +157,7 @@
public ContentType getSelectedContentType()
{
- return selectedContentType;
+ return selectedContentType;
}
public void setSelectedContentType(ContentType selectedContentType)
@@ -172,14 +182,14 @@
protected String createWindowName(String contentType, String contentURI, boolean appendNumber)
{
- String windowName = null;
+ String windowName;
ContentProvider contentProvider = ContentProviderRegistryService.getInstance().getContentProvider(ContentType.create(contentType));
String instanceName = contentProvider.getPortletInfo().getPortletName(Mode.VIEW);
- if(instanceName == null)
+ if (instanceName == null)
{
- // Content type portlet: use URI (PortletInstance)
- windowName = contentURI;
+ // Content type portlet: use URI (PortletInstance)
+ windowName = contentURI;
}
else
{
@@ -188,9 +198,9 @@
appendNumber = true;
windowName = instanceName;
}
-
+
//
- if(windowName.indexOf("Instance") != -1)
+ if (windowName.indexOf("Instance") != -1)
{
// Replace the instance with window
windowName = windowName.replace("Instance", "Window");
@@ -200,16 +210,16 @@
// Or just append window
windowName = windowName + "Window";
}
-
+
//
if (appendNumber)
{
- // if the window already exists add a random number
+ // if the window already exists add a random number
return windowName + "_" + (int)(100 * Math.random());
}
else
{
- // Just the window without any number
+ // Just the window without any number
return windowName;
}
}
@@ -219,144 +229,149 @@
String id = event.getComponent().getId();
char direction = id.charAt(0);
String regionName = id.substring(2);
-
+
// Contains the names selected window in the UI
List selectedWindows = (List)assignedWindows.values.get(regionName);
- // Get the windows belonging to the selected region sorted by order
- List windows = new ArrayList();
- for (Iterator i = page.getChildren(PortalObject.WINDOW_MASK).iterator(); i.hasNext();)
+ Collection<PortalObject> children = page.getChildren(PortalObject.WINDOW_MASK);
+ if (children != null)
{
- Window window = (Window)i.next();
- if (regionName.equals(window.getProperty(ThemeConstants.PORTAL_PROP_REGION)))
- {
- windows.add(window);
- }
- }
- Collections.sort(windows, new WindowComparator());
- //
- if (direction == MOVE_UP || direction == MOVE_DOWN)
- {
- //
- int index = direction == MOVE_UP ? 1 : windows.size() - 2;
- int length = windows.size() - 1;
- int step = direction == MOVE_UP ? 1 : -1;
-
- // Perform swaps
- while (length-- > 0)
+ // Get the windows belonging to the selected region sorted by order
+ List<Window> windows = new ArrayList<Window>(children.size());
+ for (Object o : children)
{
- Window window = (Window)windows.get(index);
- if (selectedWindows.contains(window.getName()))
+ Window window = (Window)o;
+ if (regionName.equals(window.getProperty(ThemeConstants.PORTAL_PROP_REGION)))
{
- Collections.swap(windows, index - step, index);
+ windows.add(window);
}
- index += step;
}
- }
- else if (direction == ADD_ACTION)
- {
- if (selectedContentURI != null)
+ Collections.sort(windows, new WindowComparator());
+
+ //
+ if (direction == MOVE_UP || direction == MOVE_DOWN)
{
//
- String selectedContentURI = this.selectedContentURI;
- Map selectedContentParams = this.selectedContentParameters;
+ int index = direction == MOVE_UP ? 1 : windows.size() - 2;
+ int length = windows.size() - 1;
+ int step = direction == MOVE_UP ? 1 : -1;
- // Reset to new state
- this.selectedContentURI = null;
- this.selectedContentParameters = null;
- this.selectedRenderParameters = new HashMap();
-
- // Obtain a window name
- String windowName = (String)FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("blah");
- if (windowName.trim().length() == 0)
+ // Perform swaps
+ while (length-- > 0)
{
- windowName = createWindowName(selectedContentType.toString(), selectedContentURI, false);
- while (page.getWindow(windowName) != null)
+ Window window = windows.get(index);
+ if (selectedWindows.contains(window.getName()))
{
- windowName = createWindowName(selectedContentType.toString(), selectedContentURI, true);
+ Collections.swap(windows, index - step, index);
}
+ index += step;
}
-
- // Check for duplicate window name
- if (page.getWindow(windowName) != null)
+ }
+ else if (direction == ADD_ACTION)
+ {
+ if (selectedContentURI != null)
{
- FacesContext faces = FacesContext.getCurrentInstance();
- FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Duplicate window name found on this page!", null);
- faces.addMessage("windowName", message);
- throw new AbortProcessingException();
- }
+ //
+ String selectedContentURI = this.selectedContentURI;
+ Map selectedContentParams = this.selectedContentParameters;
- //
- try
- {
- Window window = page.createWindow(windowName, selectedContentType, selectedContentURI);
- Content content = window.getContent();
- for (Iterator i = selectedContentParams.entrySet().iterator(); i.hasNext();)
+ // Reset to new state
+ this.selectedContentURI = null;
+ this.selectedContentParameters = null;
+ this.selectedRenderParameters = new HashMap();
+
+ // Obtain a window name
+ String windowName = (String)FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("blah");
+ if (windowName.trim().length() == 0)
{
- Map.Entry entry = (Map.Entry)i.next();
- String paramName = (String)entry.getKey();
- String paramValue = (String)entry.getValue();
- content.setParameter(paramName, paramValue);
+ windowName = createWindowName(selectedContentType.toString(), selectedContentURI, false);
+ while (page.getWindow(windowName) != null)
+ {
+ windowName = createWindowName(selectedContentType.toString(), selectedContentURI, true);
+ }
}
+ // Check for duplicate window name
+ if (page.getWindow(windowName) != null)
+ {
+ FacesContext faces = FacesContext.getCurrentInstance();
+ FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Duplicate window name found on this page!", null);
+ faces.addMessage("windowName", message);
+ throw new AbortProcessingException();
+ }
+
//
- window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_REGION, regionName);
- window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER, "" + Integer.MAX_VALUE);
+ try
+ {
+ Window window = page.createWindow(windowName, selectedContentType, selectedContentURI);
+ Content content = window.getContent();
+ for (Object o : selectedContentParams.entrySet())
+ {
+ Map.Entry<String,String> entry = (Map.Entry<String,String>)o;
+ String paramName = entry.getKey();
+ String paramValue = entry.getValue();
+ content.setParameter(paramName, paramValue);
+ }
- // Sort windows
- Collections.sort(windows, new WindowComparator());
+ //
+ window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_REGION, regionName);
+ window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER, "" + Integer.MAX_VALUE);
- // Add the created one
- windows.add(window);
+ // Sort windows
+ Collections.sort(windows, new WindowComparator());
- // Update the order states
- for (int i = 0; i < windows.size(); i++)
+ // Add the created one
+ windows.add(window);
+
+ // Update the order states
+ for (int i = 0; i < windows.size(); i++)
+ {
+ Window tmp = windows.get(i);
+ tmp.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER, "" + i);
+ }
+
+ this.windowName = "";
+ }
+ catch (DuplicatePortalObjectException unexpected)
{
- Window tmp = (Window)windows.get(i);
- tmp.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER, "" + i);
+ unexpected.printStackTrace();
}
-
- this.windowName = "";
}
- catch (DuplicatePortalObjectException unexpected)
+ else
{
- unexpected.printStackTrace();
+ FacesContext faces = FacesContext.getCurrentInstance();
+ FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, "No content was selected!", null);
+ faces.addMessage("layoutForm", message);
+ throw new AbortProcessingException();
}
}
- else
+ else if (direction == MOVE_LEFT)
{
- FacesContext faces = FacesContext.getCurrentInstance();
- FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, "No content was selected!", null);
- faces.addMessage("layoutForm", message);
- throw new AbortProcessingException();
- }
- }
- else if (direction == MOVE_LEFT)
- {
- for (Iterator i = windows.iterator(); i.hasNext();)
- {
- Window window = (Window)i.next();
- if (selectedWindows.contains(window.getName()))
+ for (Iterator i = windows.iterator(); i.hasNext();)
{
- i.remove();
- try
+ Window window = (Window)i.next();
+ if (selectedWindows.contains(window.getName()))
{
- page.destroyChild(window.getName());
+ i.remove();
+ try
+ {
+ page.destroyChild(window.getName());
+ }
+ catch (NoSuchPortalObjectException ignore)
+ {
+ ignore.printStackTrace();
+ }
}
- catch (NoSuchPortalObjectException ignore)
- {
- ignore.printStackTrace();
- }
}
}
- }
- // Update the order states
- for (int i = 0; i < windows.size(); i++)
- {
- Window window = (Window)windows.get(i);
- window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER, "" + i);
+ // Update the order states
+ for (int i = 0; i < windows.size(); i++)
+ {
+ Window window = windows.get(i);
+ window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER, "" + i);
+ }
}
//
@@ -389,12 +404,17 @@
else if (event instanceof PortletEventEvent)
{
PortletEventEvent eventEvent = (PortletEventEvent)event;
- // TODO: Check the QName of the event
Event portletEvent = eventEvent.getEvent();
- String uri = (String)portletEvent.getPayload();
- this.selectedContentURI = uri;
- // TODO: Get params from the payload (for widgets)
- this.selectedContentParameters = new HashMap();
+ QName name = portletEvent.getName();
+ // only react to content selection events
+ if(CONTENT_SELECT.equals(name))
+ {
+ String uri = (String)portletEvent.getPayload();
+ this.selectedContentURI = uri;
+
+ // TODO: Get params from the payload (for widgets)
+ this.selectedContentParameters = new HashMap();
+ }
}
else if (event instanceof PortletActionEvent)
{
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/jsf/common/editPageLayout.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/jsf/common/editPageLayout.xhtml 2008-05-20 22:12:48 UTC (rev 10787)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/jsf/common/editPageLayout.xhtml 2008-05-20 23:05:27 UTC (rev 10788)
@@ -38,7 +38,7 @@
</tr>
<tr>
<td>
- <h:form id="abc">
+ <h:form id="contentTypesForm">
<label for="instanceId" class="portlet-form-field-label-container">
<span class="portlet-form-field-label admin-label">Content Type:</span>
<h:inputHidden id="windowNameCopy" value="#{pageManager.windowName}"/>
@@ -46,8 +46,8 @@
id="instanceId"
value="#{pageManager.selectedContentType}"
styleClass="portlet-form-field contentType"
- onchange="document.getElementById('abc:windowNameCopy').value = document.getElementsByClassName('id-window-name')[0].value;
- document.getElementById('abc').submit(); ">
+ onchange="document.getElementById('#{pageManager.namespace}:contentTypesForm:windowNameCopy').value = document.getElementById('#{pageManager.namespace}:windowForm:windowName').value;
+ document.getElementById('#{pageManager.namespace}:contentTypesForm').submit(); ">
<f:selectItems value="#{pageManager.contentTypeItems}"/>
</h:selectOneMenu>
</label>
@@ -73,7 +73,7 @@
initialMode="edit_content"
initialWindowState="normal"
renderParameters="#{pageManager.selectedRenderParameters}"
- onClick="url.setParameter('windowName', document.getElementsByClassName('id-window-name')[0].value);"/>
+ onClick="url.setParameter('windowName', document.getElementById('#{pageManager.namespace}:windowForm:windowName').value);"/>
</td>
</tr>
</table>
@@ -102,7 +102,7 @@
<tr>
<td valign="top">
<h:commandButton
- onclick="document.getElementById('blah').value=document.getElementsByClassName('id-window-name')[0].value"
+ onclick="document.getElementById('blah').value=document.getElementById('#{pageManager.namespace}:windowForm:windowName').value"
value="Add" id="a_#{regionName}"
actionListener="#{pageManager.assignWindows}"
styleClass="portlet-form-button layout-button"/>
17 years, 11 months
JBoss Portal SVN: r10787 - branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/identity.
by portal-commits@lists.jboss.org
Author: sviluppatorefico
Date: 2008-05-20 18:12:48 -0400 (Tue, 20 May 2008)
New Revision: 10787
Modified:
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/identity/UserActivity.java
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/identity/UsersActivityStatsService.java
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/identity/UsersActivityStatsServiceImpl.java
Log:
reformatted using jboss formatter for eclipse
Modified: branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/identity/UserActivity.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/identity/UserActivity.java 2008-05-20 22:10:24 UTC (rev 10786)
+++ branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/identity/UserActivity.java 2008-05-20 22:12:48 UTC (rev 10787)
@@ -43,7 +43,7 @@
private long timestamp;
private final int type;
-
+
public final static String GUEST = "guest";
private UserActivity()
@@ -96,7 +96,6 @@
return type;
}
-
public boolean equals(Object o)
{
if (this == o)
@@ -108,7 +107,7 @@
return false;
}
- UserActivity that = (UserActivity)o;
+ UserActivity that = (UserActivity) o;
if (!id.equals(that.id) || !sessionId.equals(that.sessionId))
{
@@ -121,7 +120,7 @@
public int hashCode()
{
int result;
- result = id.hashCode()+sessionId.hashCode();
+ result = id.hashCode() + sessionId.hashCode();
return result;
}
Modified: branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/identity/UsersActivityStatsService.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/identity/UsersActivityStatsService.java 2008-05-20 22:10:24 UTC (rev 10786)
+++ branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/identity/UsersActivityStatsService.java 2008-05-20 22:12:48 UTC (rev 10787)
@@ -32,7 +32,7 @@
{
public Set getActiveUsersIds(long period);
-
+
public int getActiveSessionCount(long period);
public Set getActiveUsersNames(long period);
Modified: branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/identity/UsersActivityStatsServiceImpl.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/identity/UsersActivityStatsServiceImpl.java 2008-05-20 22:10:24 UTC (rev 10786)
+++ branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/identity/UsersActivityStatsServiceImpl.java 2008-05-20 22:12:48 UTC (rev 10787)
@@ -48,243 +48,286 @@
* @version $Revision$
*/
public class UsersActivityStatsServiceImpl extends AbstractJBossService
- implements UsersActivityStatsService, NotificationListener {
- /** Our logger. */
- private static final Logger log = Logger
- .getLogger(UsersActivityStatsServiceImpl.class);
+ implements
+ UsersActivityStatsService,
+ NotificationListener
+{
+ /** Our logger. */
+ private static final Logger log = Logger.getLogger(UsersActivityStatsServiceImpl.class);
- // TODO: some value just to begin - find some good default
- private int userTrackerThreadsNumber = 10;
+ // TODO: some value just to begin - find some good default
+ private int userTrackerThreadsNumber = 10;
- private int updaterThreadsNumber = 1;
+ private int updaterThreadsNumber = 1;
- private int updaterInterval = 1000;
+ private int updaterInterval = 1000;
- private int activityQueueLimit = 1000;
+ private int activityQueueLimit = 1000;
- private long activityTimeout = 1800000;
+ private long activityTimeout = 1800000;
- private Executor userTrackerExecutor;
+ private Executor userTrackerExecutor;
- private ScheduledExecutorService updaterExecutor;
+ private ScheduledExecutorService updaterExecutor;
- private Queue activityQueue;
+ private Queue activityQueue;
- private volatile Set activityResults = new HashSet();
+ private volatile Set activityResults = new HashSet();
- private String activityBroadcasterName;
+ private String activityBroadcasterName;
- public UsersActivityStatsServiceImpl() {
- }
+ public UsersActivityStatsServiceImpl()
+ {
+ }
- protected void startService() throws Exception {
- super.startService();
+ protected void startService() throws Exception
+ {
+ super.startService();
- activityQueue = new LinkedBlockingQueue(getActivityQueueLimit());
+ activityQueue = new LinkedBlockingQueue(getActivityQueueLimit());
- userTrackerExecutor = Executors
- .newFixedThreadPool(getUserTrackerThreadsNumber());
+ userTrackerExecutor = Executors.newFixedThreadPool(getUserTrackerThreadsNumber());
- updaterExecutor = Executors
- .newScheduledThreadPool(getUpdaterThreadsNumber());
+ updaterExecutor = Executors.newScheduledThreadPool(getUpdaterThreadsNumber());
- updaterExecutor.scheduleWithFixedDelay(new Updater(activityQueue),
- getUpdaterInterval(), getUpdaterInterval(),
- TimeUnit.MILLISECONDS);
+ updaterExecutor.scheduleWithFixedDelay(new Updater(activityQueue), getUpdaterInterval(), getUpdaterInterval(),
+ TimeUnit.MILLISECONDS);
- if (activityBroadcasterName != null) {
- server.addNotificationListener(new ObjectName(
- activityBroadcasterName), this, null, null);
- } else {
- addNotificationListener(this, null, null);
- }
+ if (activityBroadcasterName != null)
+ {
+ server.addNotificationListener(new ObjectName(activityBroadcasterName), this, null, null);
+ }
+ else
+ {
+ addNotificationListener(this, null, null);
+ }
- }
+ }
- protected void stopService() throws Exception {
- super.stopService();
+ protected void stopService() throws Exception
+ {
+ super.stopService();
- // /TODO: stop all the threads
- }
+ // /TODO: stop all the threads
+ }
- public Set getActiveUsersIds(long period) {
- long currentTime = System.currentTimeMillis();
+ public Set getActiveUsersIds(long period)
+ {
+ long currentTime = System.currentTimeMillis();
- Set results = new HashSet();
- for (Iterator iterator = activityResults.iterator(); iterator.hasNext();) {
- UserActivity ua = (UserActivity) iterator.next();
- if (currentTime - ua.getTimestamp() < period
- && !ua.getId().equals(UserActivity.GUEST)) {
- results.add(ua.getSessionId());
- }
- }
- return results;
- }
+ Set results = new HashSet();
+ for (Iterator iterator = activityResults.iterator(); iterator.hasNext();)
+ {
+ UserActivity ua = (UserActivity) iterator.next();
+ if (currentTime - ua.getTimestamp() < period && !ua.getId().equals(UserActivity.GUEST))
+ {
+ results.add(ua.getSessionId());
+ }
+ }
+ return results;
+ }
- public int getActiveSessionCount(long period) {
- long currentTime = System.currentTimeMillis();
+ public int getActiveSessionCount(long period)
+ {
+ long currentTime = System.currentTimeMillis();
- int results = 0;
- for (Iterator iterator = activityResults.iterator(); iterator.hasNext();) {
- UserActivity ua = (UserActivity) iterator.next();
- if (currentTime - ua.getTimestamp() < period
- && ua.getId().equals(UserActivity.GUEST)) {
- results++;
- }
- }
- return results;
- }
+ int results = 0;
+ for (Iterator iterator = activityResults.iterator(); iterator.hasNext();)
+ {
+ UserActivity ua = (UserActivity) iterator.next();
+ if (currentTime - ua.getTimestamp() < period && ua.getId().equals(UserActivity.GUEST))
+ {
+ results++;
+ }
+ }
+ return results;
+ }
- public Set getActiveUsersNames(long period) {
- long currentTime = System.currentTimeMillis();
- Set results = new HashSet();
- for (Iterator iterator = activityResults.iterator(); iterator.hasNext();) {
- UserActivity ua = (UserActivity) iterator.next();
- if (currentTime - ua.getTimestamp() < period
- && !ua.getId().equals(UserActivity.GUEST)) {
- results.add(ua.getId());
- }
- }
- return results;
- }
+ public Set getActiveUsersNames(long period)
+ {
+ long currentTime = System.currentTimeMillis();
+ Set results = new HashSet();
+ for (Iterator iterator = activityResults.iterator(); iterator.hasNext();)
+ {
+ UserActivity ua = (UserActivity) iterator.next();
+ if (currentTime - ua.getTimestamp() < period && !ua.getId().equals(UserActivity.GUEST))
+ {
+ results.add(ua.getId());
+ }
+ }
+ return results;
+ }
- public Set getUsersActivities(long period) {
- long currentTime = System.currentTimeMillis();
- Set results = new HashSet();
- for (Iterator iterator = activityResults.iterator(); iterator.hasNext();) {
- UserActivity ua = (UserActivity) iterator.next();
- if (currentTime - ua.getTimestamp() < period) {
- results.add(ua);
- }
- }
- return results;
- }
+ public Set getUsersActivities(long period)
+ {
+ long currentTime = System.currentTimeMillis();
+ Set results = new HashSet();
+ for (Iterator iterator = activityResults.iterator(); iterator.hasNext();)
+ {
+ UserActivity ua = (UserActivity) iterator.next();
+ if (currentTime - ua.getTimestamp() < period)
+ {
+ results.add(ua);
+ }
+ }
+ return results;
+ }
- public void registerActivity(final UserActivity userActivity) {
- try {
- Notification notification = new Notification(Integer
- .toString(userActivity.getType()), this.getServiceName(),
- userActivity.getTimestamp(), userActivity.getTimestamp(),
- userActivity.getId() + "_" + userActivity.getSessionId());
+ public void registerActivity(final UserActivity userActivity)
+ {
+ try
+ {
+ Notification notification = new Notification(Integer.toString(userActivity.getType()), this.getServiceName(),
+ userActivity.getTimestamp(), userActivity.getTimestamp(), userActivity.getId() + "_"
+ + userActivity.getSessionId());
- if (activityBroadcasterName != null) {
- log.debug("Broadcasting user activity notification ");
+ if (activityBroadcasterName != null)
+ {
+ log.debug("Broadcasting user activity notification ");
- server.invoke(new ObjectName(activityBroadcasterName),
- "sendNotification", new Object[] { notification },
- new String[] { Notification.class.getName() });
- } else {
- log.debug("Sending local user activity notification ");
- sendNotification(notification);
- }
+ server.invoke(new ObjectName(activityBroadcasterName), "sendNotification", new Object[]
+ {notification}, new String[]
+ {Notification.class.getName()});
+ }
+ else
+ {
+ log.debug("Sending local user activity notification ");
+ sendNotification(notification);
+ }
- } catch (Exception e) {
- log.error("Failed to send user activity notification: ", e);
- }
+ }
+ catch (Exception e)
+ {
+ log.error("Failed to send user activity notification: ", e);
+ }
- }
+ }
- public void handleNotification(Notification notification, Object object) {
- log.debug("Handling user activity notification ");
- final UserActivity ac = new UserActivity(notification);
+ public void handleNotification(Notification notification, Object object)
+ {
+ log.debug("Handling user activity notification ");
+ final UserActivity ac = new UserActivity(notification);
- FutureTask task = new FutureTask(new Callable() {
- public Object call() throws Exception {
+ FutureTask task = new FutureTask(new Callable()
+ {
+ public Object call() throws Exception
+ {
- boolean success = activityQueue.offer(ac);
- if (log.isTraceEnabled()) {
- if (!success) {
- log
- .trace("Failed track user activity - activityQueue is full ");
- }
- }
- return null;
- }
- });
+ boolean success = activityQueue.offer(ac);
+ if (log.isTraceEnabled())
+ {
+ if (!success)
+ {
+ log.trace("Failed track user activity - activityQueue is full ");
+ }
+ }
+ return null;
+ }
+ });
- userTrackerExecutor.execute(task);
- }
+ userTrackerExecutor.execute(task);
+ }
- public int getUserTrackerThreadsNumber() {
- return userTrackerThreadsNumber;
- }
+ public int getUserTrackerThreadsNumber()
+ {
+ return userTrackerThreadsNumber;
+ }
- public void setUserTrackerThreadsNumber(int userTrackerThreadsNumber) {
- this.userTrackerThreadsNumber = userTrackerThreadsNumber;
- }
+ public void setUserTrackerThreadsNumber(int userTrackerThreadsNumber)
+ {
+ this.userTrackerThreadsNumber = userTrackerThreadsNumber;
+ }
- public int getUpdaterThreadsNumber() {
- return updaterThreadsNumber;
- }
+ public int getUpdaterThreadsNumber()
+ {
+ return updaterThreadsNumber;
+ }
- public void setUpdaterThreadsNumber(int updaterThreadsNumber) {
- this.updaterThreadsNumber = updaterThreadsNumber;
- }
+ public void setUpdaterThreadsNumber(int updaterThreadsNumber)
+ {
+ this.updaterThreadsNumber = updaterThreadsNumber;
+ }
- public int getUpdaterInterval() {
- return updaterInterval;
- }
+ public int getUpdaterInterval()
+ {
+ return updaterInterval;
+ }
- public void setUpdaterInterval(int updaterInterval) {
- this.updaterInterval = updaterInterval;
- }
+ public void setUpdaterInterval(int updaterInterval)
+ {
+ this.updaterInterval = updaterInterval;
+ }
- public int getActivityQueueLimit() {
- return activityQueueLimit;
- }
+ public int getActivityQueueLimit()
+ {
+ return activityQueueLimit;
+ }
- public void setActivityQueueLimit(int activityQueueLimit) {
- this.activityQueueLimit = activityQueueLimit;
- }
+ public void setActivityQueueLimit(int activityQueueLimit)
+ {
+ this.activityQueueLimit = activityQueueLimit;
+ }
- public long getActivityTimeout() {
- return activityTimeout;
- }
+ public long getActivityTimeout()
+ {
+ return activityTimeout;
+ }
- public void setActivityTimeout(long activityTimeout) {
- this.activityTimeout = activityTimeout;
- }
+ public void setActivityTimeout(long activityTimeout)
+ {
+ this.activityTimeout = activityTimeout;
+ }
- public String getActivityBroadcasterName() {
- return activityBroadcasterName;
- }
+ public String getActivityBroadcasterName()
+ {
+ return activityBroadcasterName;
+ }
- public void setActivityBroadcasterName(String activityBroadcasterName) {
- this.activityBroadcasterName = activityBroadcasterName;
- }
+ public void setActivityBroadcasterName(String activityBroadcasterName)
+ {
+ this.activityBroadcasterName = activityBroadcasterName;
+ }
- private class Updater implements Runnable {
- private final Queue activityQueue;
+ private class Updater implements Runnable
+ {
+ private final Queue activityQueue;
- public Updater(Queue activityQueue) {
- this.activityQueue = activityQueue;
- }
+ public Updater(Queue activityQueue)
+ {
+ this.activityQueue = activityQueue;
+ }
- // never run
- private Updater() {
- this.activityQueue = null;
- }
+ // never run
+ private Updater()
+ {
+ this.activityQueue = null;
+ }
- public void run() {
- long currentTime = System.currentTimeMillis();
+ public void run()
+ {
+ long currentTime = System.currentTimeMillis();
- Set stillActive = getUsersActivities(activityTimeout);
+ Set stillActive = getUsersActivities(activityTimeout);
- while (!activityQueue.isEmpty()) {
- UserActivity activity = (UserActivity) activityQueue.poll();
- if (activity != null
- && ((currentTime - activity.getTimestamp()) < activityTimeout)) {
- if (activity.getType() != UserActivity.EXIT) {
- stillActive.add(activity);
- } else {
- stillActive.remove(activity);
- }
- }
- }
+ while (!activityQueue.isEmpty())
+ {
+ UserActivity activity = (UserActivity) activityQueue.poll();
+ if (activity != null && ((currentTime - activity.getTimestamp()) < activityTimeout))
+ {
+ if (activity.getType() != UserActivity.EXIT)
+ {
+ stillActive.add(activity);
+ }
+ else
+ {
+ stillActive.remove(activity);
+ }
+ }
+ }
- activityResults = Collections.unmodifiableSet(stillActive);
+ activityResults = Collections.unmodifiableSet(stillActive);
- }
- }
+ }
+ }
}
17 years, 11 months
JBoss Portal SVN: r10786 - branches/JBoss_Portal_Branch_2_6/core-samples/src/main/org/jboss/portal/core/samples/users/event.
by portal-commits@lists.jboss.org
Author: sviluppatorefico
Date: 2008-05-20 18:10:24 -0400 (Tue, 20 May 2008)
New Revision: 10786
Modified:
branches/JBoss_Portal_Branch_2_6/core-samples/src/main/org/jboss/portal/core/samples/users/event/PortalSessionEventListener.java
Log:
reformatting using jboss formatter for eclipse
Modified: branches/JBoss_Portal_Branch_2_6/core-samples/src/main/org/jboss/portal/core/samples/users/event/PortalSessionEventListener.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-samples/src/main/org/jboss/portal/core/samples/users/event/PortalSessionEventListener.java 2008-05-20 21:57:39 UTC (rev 10785)
+++ branches/JBoss_Portal_Branch_2_6/core-samples/src/main/org/jboss/portal/core/samples/users/event/PortalSessionEventListener.java 2008-05-20 22:10:24 UTC (rev 10786)
@@ -41,12 +41,12 @@
PortalSessionEvent portalEvent = (PortalSessionEvent) event;
UserActivity userActivity = null;
- if (portalEvent.getType() == portalEvent.SESSION_CREATED)
+ if (portalEvent.getType() == PortalSessionEvent.SESSION_CREATED)
{
userActivity = new UserActivity(UserActivity.GUEST, eventContext.getPortalRuntimeContext().getSession()
.getId(), System.currentTimeMillis(), UserActivity.NAVIGATION);
}
- else if (portalEvent.getType() == portalEvent.SESSION_DESTROYED)
+ else if (portalEvent.getType() == PortalSessionEvent.SESSION_DESTROYED)
{
userActivity = new UserActivity(UserActivity.GUEST, eventContext.getPortalRuntimeContext().getSession()
.getId(), System.currentTimeMillis(), UserActivity.EXIT);
17 years, 11 months
JBoss Portal SVN: r10785 - in branches/JBoss_Portal_Branch_2_6/core-samples/src/main/org/jboss/portal/core/samples/users: event and 1 other directory.
by portal-commits@lists.jboss.org
Author: sviluppatorefico
Date: 2008-05-20 17:57:39 -0400 (Tue, 20 May 2008)
New Revision: 10785
Modified:
branches/JBoss_Portal_Branch_2_6/core-samples/src/main/org/jboss/portal/core/samples/users/CurrentUsersPortlet.java
branches/JBoss_Portal_Branch_2_6/core-samples/src/main/org/jboss/portal/core/samples/users/event/PortalSessionEventListener.java
branches/JBoss_Portal_Branch_2_6/core-samples/src/main/org/jboss/portal/core/samples/users/event/StatsListener.java
branches/JBoss_Portal_Branch_2_6/core-samples/src/main/org/jboss/portal/core/samples/users/event/UserEventListener.java
Log:
reformatting the code using jboss formatter for eclipse
Modified: branches/JBoss_Portal_Branch_2_6/core-samples/src/main/org/jboss/portal/core/samples/users/CurrentUsersPortlet.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-samples/src/main/org/jboss/portal/core/samples/users/CurrentUsersPortlet.java 2008-05-20 15:13:28 UTC (rev 10784)
+++ branches/JBoss_Portal_Branch_2_6/core-samples/src/main/org/jboss/portal/core/samples/users/CurrentUsersPortlet.java 2008-05-20 21:57:39 UTC (rev 10785)
@@ -48,22 +48,22 @@
/** Logger */
public static Logger log = Logger.getLogger(CurrentUsersPortlet.class);
- protected void doView(JBossRenderRequest rRequest, JBossRenderResponse rResponse)
- throws PortletException, IOException, UnavailableException
+ protected void doView(JBossRenderRequest rRequest, JBossRenderResponse rResponse) throws PortletException,
+ IOException, UnavailableException
{
- UsersActivityStatsService uass = (UsersActivityStatsService)this
- .getPortletContext().getAttribute("UsersActivityStats");
+ UsersActivityStatsService uass = (UsersActivityStatsService) this.getPortletContext().getAttribute(
+ "UsersActivityStats");
rResponse.setContentType("text/html");
PrintWriter writer = rResponse.getWriter();
-
+
long currentTime = System.currentTimeMillis();
//TODO: this is wrong - should pass period instead of current time - actually it works by a coincedence...
Set users = uass.getActiveUsersNames(currentTime);
-
+
int sessionCount = uass.getActiveSessionCount(currentTime);
-
+
int allLoggedSessions = uass.getUsersActivities(currentTime).size();
if (sessionCount == 1)
@@ -91,7 +91,6 @@
rd.include(rRequest, rResponse);
}
-
writer.close();
}
}
Modified: branches/JBoss_Portal_Branch_2_6/core-samples/src/main/org/jboss/portal/core/samples/users/event/PortalSessionEventListener.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-samples/src/main/org/jboss/portal/core/samples/users/event/PortalSessionEventListener.java 2008-05-20 15:13:28 UTC (rev 10784)
+++ branches/JBoss_Portal_Branch_2_6/core-samples/src/main/org/jboss/portal/core/samples/users/event/PortalSessionEventListener.java 2008-05-20 21:57:39 UTC (rev 10785)
@@ -24,37 +24,34 @@
import org.jboss.portal.api.event.PortalEvent;
import org.jboss.portal.api.event.PortalEventContext;
-import org.jboss.portal.api.event.PortalEventListener;
import org.jboss.portal.api.session.event.PortalSessionEvent;
-import org.jboss.portal.api.user.event.UserAuthenticationEvent;
import org.jboss.portal.core.identity.UserActivity;
-import EDU.oswego.cs.dl.util.concurrent.SynchronizedLong;
-
/**
* @author <a href="mailto:jedim@vige.it">Luca Stancapiano</a>
* @version $Revision: 1.1 $
*/
-public class PortalSessionEventListener extends StatsListener {
+public class PortalSessionEventListener extends StatsListener
+{
- public void onEvent(PortalEventContext eventContext, PortalEvent event) {
- if (event instanceof PortalSessionEvent) {
- PortalSessionEvent portalEvent = (PortalSessionEvent) event;
- UserActivity userActivity = null;
+ public void onEvent(PortalEventContext eventContext, PortalEvent event)
+ {
+ if (event instanceof PortalSessionEvent)
+ {
+ PortalSessionEvent portalEvent = (PortalSessionEvent) event;
+ UserActivity userActivity = null;
- if (portalEvent.getType() == portalEvent.SESSION_CREATED)
- {
- userActivity = new UserActivity(UserActivity.GUEST,
- eventContext.getPortalRuntimeContext().getSession().getId(), System
- .currentTimeMillis(), UserActivity.NAVIGATION);
- }
- else if (portalEvent.getType() == portalEvent.SESSION_DESTROYED)
- {
- userActivity = new UserActivity(UserActivity.GUEST,
- eventContext.getPortalRuntimeContext().getSession().getId(), System
- .currentTimeMillis(), UserActivity.EXIT);
- }
- getStatsService().registerActivity(userActivity);
- }
- }
+ if (portalEvent.getType() == portalEvent.SESSION_CREATED)
+ {
+ userActivity = new UserActivity(UserActivity.GUEST, eventContext.getPortalRuntimeContext().getSession()
+ .getId(), System.currentTimeMillis(), UserActivity.NAVIGATION);
+ }
+ else if (portalEvent.getType() == portalEvent.SESSION_DESTROYED)
+ {
+ userActivity = new UserActivity(UserActivity.GUEST, eventContext.getPortalRuntimeContext().getSession()
+ .getId(), System.currentTimeMillis(), UserActivity.EXIT);
+ }
+ getStatsService().registerActivity(userActivity);
+ }
+ }
}
Modified: branches/JBoss_Portal_Branch_2_6/core-samples/src/main/org/jboss/portal/core/samples/users/event/StatsListener.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-samples/src/main/org/jboss/portal/core/samples/users/event/StatsListener.java 2008-05-20 15:13:28 UTC (rev 10784)
+++ branches/JBoss_Portal_Branch_2_6/core-samples/src/main/org/jboss/portal/core/samples/users/event/StatsListener.java 2008-05-20 21:57:39 UTC (rev 10785)
@@ -11,36 +11,34 @@
import org.jboss.portal.api.event.PortalEventListener;
import org.jboss.portal.core.identity.UsersActivityStatsService;
-public abstract class StatsListener implements PortalEventListener {
+public abstract class StatsListener implements PortalEventListener
+{
- /** Our logger. */
- private static final Logger log = Logger.getLogger(StatsListener.class);
+ /** Our logger. */
+ private static final Logger log = Logger.getLogger(StatsListener.class);
- private UsersActivityStatsService activityService;
+ private UsersActivityStatsService activityService;
- public UsersActivityStatsService getStatsService() {
- if (activityService == null) {
- try {
- MBeanServer mbeanServer = MBeanServerLocator.locateJBoss();
- activityService = (UsersActivityStatsService) MBeanProxy
- .get(
- UsersActivityStatsService.class,
- new ObjectName(
- "portal:service=Module,type=UsersActivityStatsService"),
- mbeanServer);
- } catch (MBeanProxyCreationException e) {
- log
- .error(
- "could not obtain a proxy for User Activity Statistics Service",
- e);
- } catch (MalformedObjectNameException e2) {
- log
- .error(
- "object name to obtain User Activity Statistics Service is wrong",
- e2);
- }
- }
- return activityService;
- }
+ public UsersActivityStatsService getStatsService()
+ {
+ if (activityService == null)
+ {
+ try
+ {
+ MBeanServer mbeanServer = MBeanServerLocator.locateJBoss();
+ activityService = (UsersActivityStatsService) MBeanProxy.get(UsersActivityStatsService.class,
+ new ObjectName("portal:service=Module,type=UsersActivityStatsService"), mbeanServer);
+ }
+ catch (MBeanProxyCreationException e)
+ {
+ log.error("could not obtain a proxy for User Activity Statistics Service", e);
+ }
+ catch (MalformedObjectNameException e2)
+ {
+ log.error("object name to obtain User Activity Statistics Service is wrong", e2);
+ }
+ }
+ return activityService;
+ }
}
Modified: branches/JBoss_Portal_Branch_2_6/core-samples/src/main/org/jboss/portal/core/samples/users/event/UserEventListener.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-samples/src/main/org/jboss/portal/core/samples/users/event/UserEventListener.java 2008-05-20 15:13:28 UTC (rev 10784)
+++ branches/JBoss_Portal_Branch_2_6/core-samples/src/main/org/jboss/portal/core/samples/users/event/UserEventListener.java 2008-05-20 21:57:39 UTC (rev 10785)
@@ -31,27 +31,29 @@
* @author <a href="mailto:jedim@vige.it">Luca Stancapiano</a>
* @version $Revision: 1.1 $
*/
-public class UserEventListener extends StatsListener {
+public class UserEventListener extends StatsListener
+{
- public void onEvent(PortalEventContext eventContext, PortalEvent event) {
- if (event instanceof UserAuthenticationEvent) {
+ public void onEvent(PortalEventContext eventContext, PortalEvent event)
+ {
+ if (event instanceof UserAuthenticationEvent)
+ {
- UserAuthenticationEvent userEvent = (UserAuthenticationEvent) event;
+ UserAuthenticationEvent userEvent = (UserAuthenticationEvent) event;
- UserActivity userActivity = null;
+ UserActivity userActivity = null;
- if (userEvent.getType() == UserAuthenticationEvent.SIGN_IN) {
- userActivity = new UserActivity(userEvent.getUserId(),
- eventContext.getPortalRuntimeContext().getSession().getId()
- , System.currentTimeMillis(),
- UserActivity.NAVIGATION);
- } else if (userEvent.getType() == UserAuthenticationEvent.SIGN_OUT) {
- userActivity = new UserActivity(userEvent.getUserId(),
- eventContext.getPortalRuntimeContext().getSession().getId()
- , System.currentTimeMillis(),
- UserActivity.EXIT);
- }
- getStatsService().registerActivity(userActivity);
- }
- }
+ if (userEvent.getType() == UserAuthenticationEvent.SIGN_IN)
+ {
+ userActivity = new UserActivity(userEvent.getUserId(), eventContext.getPortalRuntimeContext().getSession()
+ .getId(), System.currentTimeMillis(), UserActivity.NAVIGATION);
+ }
+ else if (userEvent.getType() == UserAuthenticationEvent.SIGN_OUT)
+ {
+ userActivity = new UserActivity(userEvent.getUserId(), eventContext.getPortalRuntimeContext().getSession()
+ .getId(), System.currentTimeMillis(), UserActivity.EXIT);
+ }
+ getStatsService().registerActivity(userActivity);
+ }
+ }
}
17 years, 11 months
JBoss Portal SVN: r10783 - in modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity: auth and 1 other directories.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2008-05-20 10:18:07 -0400 (Tue, 20 May 2008)
New Revision: 10783
Modified:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/IdentityConfiguration.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/auth/IdentityLoginModule.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserModule.java
Log:
Add option to make portal authentication non case sensitive - customer request
Modified: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/IdentityConfiguration.java
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/IdentityConfiguration.java 2008-05-20 14:03:57 UTC (rev 10782)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/IdentityConfiguration.java 2008-05-20 14:18:07 UTC (rev 10783)
@@ -71,6 +71,8 @@
public static final String USER_ALLOW_EMPTY_PASSWORDS = "allowEmptyPasswords";
+ public static final String USER_USER_NAME_TO_LOWER_CASE = "userNameToLowerCase";
+
//public static final String ROLE_CONTAINER_DN = "roleContainerDN";
public static final String ROLE_RID_ATTRIBUTE_ID = "ridAttributeID";
Modified: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/auth/IdentityLoginModule.java
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/auth/IdentityLoginModule.java 2008-05-20 14:03:57 UTC (rev 10782)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/auth/IdentityLoginModule.java 2008-05-20 14:18:07 UTC (rev 10783)
@@ -74,6 +74,8 @@
protected String validateUserNameCase;
+ protected String userNameToLowerCase;
+
public void initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options)
{
super.initialize(subject, callbackHandler, sharedState, options);
@@ -88,6 +90,7 @@
additionalRole = (String) options.get("additionalRole");
havingRole = (String) options.get("havingRole");
validateUserNameCase = (String) options.get("validateUserNameCase");
+ userNameToLowerCase = (String) options.get("userNameToLowerCase");
// Some info
log.trace("userModuleJNDIName = " + userModuleJNDIName);
@@ -97,6 +100,7 @@
log.trace("additionalRole = " + additionalRole);
log.trace("havingRole = " + havingRole);
log.trace("validateUserNameCase = " + validateUserNameCase);
+ log.trace("userNameToLowerCase = " + userNameToLowerCase);
}
private UserModule userModule;
@@ -356,4 +360,28 @@
{
return new UserPrincipal(username);
}
+
+ protected String getUsername()
+ {
+ if (userNameToLowerCase != null && userNameToLowerCase.equalsIgnoreCase("true"))
+ {
+ return super.getUsername().toLowerCase();
+ }
+ return super.getUsername();
+ }
+
+ protected String[] getUsernameAndPassword() throws LoginException
+ {
+ String[] names = super.getUsernameAndPassword();
+
+ if (userNameToLowerCase != null && userNameToLowerCase.equalsIgnoreCase("true"))
+ {
+ if (names[0] != null)
+ {
+ names[0] = names[0].toLowerCase();
+ }
+ }
+ return names;
+
+ }
}
Modified: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserModule.java
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserModule.java 2008-05-20 14:03:57 UTC (rev 10782)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserModule.java 2008-05-20 14:18:07 UTC (rev 10783)
@@ -199,8 +199,16 @@
//make DN as user ID
ldapu = new LDAPUserImpl(dn,getIdentityContext(), dn);
- ldapu.setUserName(uida.get().toString());
+ if (isUserNameToLowerCase())
+ {
+ ldapu.setUserName(uida.get().toString().toLowerCase());
+ }
+ else
+ {
+ ldapu.setUserName(uida.get().toString());
+ }
+
log.debug("user uid: " + ldapu.getId());
log.debug("user dn: " + ldapu.getDn());
@@ -415,7 +423,16 @@
return Boolean.FALSE.booleanValue();
}
+ protected boolean isUserNameToLowerCase()
+ {
+ String userNameToLowerCase = getIdentityConfiguration().getValue(IdentityConfiguration.USER_USER_NAME_TO_LOWER_CASE);
+ if (userNameToLowerCase != null && userNameToLowerCase.equalsIgnoreCase("true"))
+ {
+ return Boolean.TRUE.booleanValue();
+ }
+ return Boolean.FALSE.booleanValue();
+ }
/*protected String getEmailAttributeId() throws IdentityException
17 years, 11 months