From do-not-reply at jboss.org Wed Jun 1 01:39:20 2011 Content-Type: multipart/mixed; boundary="===============8264961575137455792==" MIME-Version: 1.0 From: do-not-reply at jboss.org To: exo-jcr-commits at lists.jboss.org Subject: [exo-jcr-commits] exo-jcr SVN: r4466 - core/branches/2.3.x/patch/2.3.10/COR-34. Date: Wed, 01 Jun 2011 01:39:20 -0400 Message-ID: <201106010539.p515dKfP026624@svn01.web.mwc.hst.phx2.redhat.com> --===============8264961575137455792== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: tolusha Date: 2011-06-01 01:39:20 -0400 (Wed, 01 Jun 2011) New Revision: 4466 Modified: core/branches/2.3.x/patch/2.3.10/COR-34/COR-34.patch Log: COR-34: patch updated Modified: core/branches/2.3.x/patch/2.3.10/COR-34/COR-34.patch =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- core/branches/2.3.x/patch/2.3.10/COR-34/COR-34.patch 2011-05-31 14:59:5= 4 UTC (rev 4465) +++ core/branches/2.3.x/patch/2.3.10/COR-34/COR-34.patch 2011-06-01 05:39:2= 0 UTC (rev 4466) @@ -1,3 +1,190 @@ +Index: exo.core.component.organization.ldap/src/main/java/org/exoplatform/= services/organization/ldap/CacheHandler.java +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +--- exo.core.component.organization.ldap/src/main/java/org/exoplatform/ser= vices/organization/ldap/CacheHandler.java (revision 0) ++++ exo.core.component.organization.ldap/src/main/java/org/exoplatform/ser= vices/organization/ldap/CacheHandler.java (revision 0) +@@ -0,0 +1,182 @@ ++/* ++ * Copyright (C) 2011 eXo Platform SAS. ++ * ++ * 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.exoplatform.services.organization.ldap; ++ ++import org.exoplatform.services.cache.CacheService; ++import org.exoplatform.services.cache.ExoCache; ++import org.exoplatform.services.organization.Group; ++import org.exoplatform.services.organization.Membership; ++import org.exoplatform.services.organization.MembershipType; ++import org.exoplatform.services.organization.User; ++ ++import java.io.Serializable; ++ ++/** ++ * @author Anatoliy Bazko ++ * @version $Id: CacheHandler.java 34360 2009-07-22 23:58:59Z tolusha $ ++ */ ++public class CacheHandler ++{ ++ public static final String MEMBERSHIPTYPE_PREFIX =3D "mt=3D"; ++ ++ public static final String GROUP_PREFIX =3D "g=3D"; ++ ++ public static final String USER_PREFIX =3D "u=3D"; ++ ++ /** ++ * The cache service. ++ */ ++ private final CacheService cservice; ++ ++ /** ++ * Cache for Users. ++ */ ++ private final ExoCache userCache; ++ ++ /** ++ * Cache for MembershipTypes. ++ */ ++ private final ExoCache membershipTypeCac= he; ++ ++ /** ++ * Cache for Memberships. ++ */ ++ private final ExoCache membershipCache; ++ ++ /** ++ * Cache for Groups. ++ */ ++ private final ExoCache groupCache; ++ ++ /** ++ * Constructor CacheHandler. = ++ * = ++ * @param cservice ++ * The cache handler ++ */ ++ public CacheHandler(CacheService cservice) ++ { ++ this.cservice =3D cservice; ++ this.userCache =3D cservice.getCacheInstance(this.getClass().getNam= e() + "userCache"); ++ this.membershipTypeCache =3D cservice.getCacheInstance(this.getClas= s().getName() + "membershipTypeCache"); ++ this.groupCache =3D cservice.getCacheInstance(this.getClass().getNa= me() + "groupCache"); ++ this.membershipCache =3D cservice.getCacheInstance(this.getClass().= getName() + "membershipCache"); ++ } ++ ++ public void put(Serializable key, Object value, CacheType cacheType) ++ { ++ if (cacheType =3D=3D CacheType.USER) ++ { ++ userCache.put(key, (User)value); ++ } ++ else if (cacheType =3D=3D CacheType.GROUP) ++ { ++ groupCache.put(key, (Group)value); ++ } ++ else if (cacheType =3D=3D CacheType.MEMBERSHIP) ++ { ++ membershipCache.put(key, (Membership)value); ++ } ++ else if (cacheType =3D=3D CacheType.MEMBERSHIPTYPE) ++ { ++ membershipTypeCache.put(key, (MembershipType)value); ++ } ++ } ++ ++ public Object get(Serializable key, CacheType cacheType) ++ { ++ if (cacheType =3D=3D CacheType.USER) ++ { ++ return userCache.get(key); ++ } ++ else if (cacheType =3D=3D CacheType.GROUP) ++ { ++ return groupCache.get(key); ++ } ++ else if (cacheType =3D=3D CacheType.MEMBERSHIP) ++ { ++ return membershipCache.get(key); ++ } ++ else if (cacheType =3D=3D CacheType.MEMBERSHIPTYPE) ++ { ++ return membershipTypeCache.get(key); ++ } ++ ++ return null; ++ } ++ ++ public void remove(Serializable key, CacheType cacheType) ++ { ++ if (cacheType =3D=3D CacheType.USER) ++ { ++ userCache.remove(key); ++ } ++ else if (cacheType =3D=3D CacheType.GROUP) ++ { ++ groupCache.remove(key); ++ } ++ else if (cacheType =3D=3D CacheType.MEMBERSHIP) ++ { ++ try ++ { ++ String tKey =3D ((String)key).toUpperCase(); ++ for (Membership m : membershipCache.getCachedObjects()) ++ { ++ String mkey =3D getMembershipKey(m); ++ if (mkey.toUpperCase().indexOf(tKey) >=3D 0) ++ { ++ membershipCache.remove(mkey); ++ } ++ } ++ } ++ catch (Exception e) ++ { ++ } ++ } ++ else if (cacheType =3D=3D CacheType.MEMBERSHIPTYPE) ++ { ++ membershipTypeCache.remove(key); ++ } ++ } ++ ++ public String getMembershipKey(Membership m) ++ { ++ StringBuilder key =3D new StringBuilder(); ++ key.append(GROUP_PREFIX + m.getGroupId()); ++ key.append(MEMBERSHIPTYPE_PREFIX + m.getMembershipType()); ++ key.append(USER_PREFIX + m.getUserName()); ++ ++ return key.toString(); ++ } ++ ++ public String getMembershipKey(String username, String groupId, String= type) ++ { ++ StringBuilder key =3D new StringBuilder(); ++ key.append(GROUP_PREFIX + groupId); ++ key.append(MEMBERSHIPTYPE_PREFIX + type); ++ key.append(USER_PREFIX + username); ++ ++ return key.toString(); ++ } ++ ++ static enum CacheType ++ { ++ USER, GROUP, MEMBERSHIP, MEMBERSHIPTYPE ++ } ++} Index: exo.core.component.organization.ldap/src/main/java/org/exoplatform/= services/organization/ldap/MembershipDAOImpl.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- exo.core.component.organization.ldap/src/main/java/org/exoplatform/ser= vices/organization/ldap/MembershipDAOImpl.java (revision 4450) @@ -469,28 +656,6 @@ Attributes attrs =3D sr.getAttributes(); Attribute attr =3D attrs.get("tokenGroups"); for (int x =3D 0; x < attr.size(); x++) -Index: exo.core.component.organization.ldap/src/main/java/org/exoplatform/= services/organization/ldap/ADGroupDAOImpl.java -=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D ---- exo.core.component.organization.ldap/src/main/java/org/exoplatform/ser= vices/organization/ldap/ADGroupDAOImpl.java (revision 4450) -+++ exo.core.component.organization.ldap/src/main/java/org/exoplatform/ser= vices/organization/ldap/ADGroupDAOImpl.java (working copy) -@@ -48,12 +48,14 @@ - * items - * @param ldapService {@link LDAPService} - * @param ad See {@link ADSearchBySID} -+ * @param cacheHandler -+ * The Cache Handler - * @throws Exception if any errors occurs - */ -- public ADGroupDAOImpl(LDAPAttributeMapping ldapAttrMapping, LDAPServic= e ldapService, ADSearchBySID ad) -- throws Exception -+ public ADGroupDAOImpl(LDAPAttributeMapping ldapAttrMapping, LDAPServic= e ldapService, ADSearchBySID ad, -+ CacheHandler cacheHandler) throws Exception - { -- super(ldapAttrMapping, ldapService); -+ super(ldapAttrMapping, ldapService, cacheHandler); - adSearch =3D ad; - } - = Index: exo.core.component.organization.ldap/src/main/java/org/exoplatform/= services/organization/ldap/OrganizationServiceImpl.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- exo.core.component.organization.ldap/src/main/java/org/exoplatform/ser= vices/organization/ldap/OrganizationServiceImpl.java (revision 4450) @@ -530,6 +695,28 @@ = ValueParam param =3D params.getValueParam("ldap.userDN.key"); if (param !=3D null) +Index: exo.core.component.organization.ldap/src/main/java/org/exoplatform/= services/organization/ldap/ADGroupDAOImpl.java +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +--- exo.core.component.organization.ldap/src/main/java/org/exoplatform/ser= vices/organization/ldap/ADGroupDAOImpl.java (revision 4450) ++++ exo.core.component.organization.ldap/src/main/java/org/exoplatform/ser= vices/organization/ldap/ADGroupDAOImpl.java (working copy) +@@ -48,12 +48,14 @@ + * items + * @param ldapService {@link LDAPService} + * @param ad See {@link ADSearchBySID} ++ * @param cacheHandler ++ * The Cache Handler + * @throws Exception if any errors occurs + */ +- public ADGroupDAOImpl(LDAPAttributeMapping ldapAttrMapping, LDAPServic= e ldapService, ADSearchBySID ad) +- throws Exception ++ public ADGroupDAOImpl(LDAPAttributeMapping ldapAttrMapping, LDAPServic= e ldapService, ADSearchBySID ad, ++ CacheHandler cacheHandler) throws Exception + { +- super(ldapAttrMapping, ldapService); ++ super(ldapAttrMapping, ldapService, cacheHandler); + adSearch =3D ad; + } + = Index: exo.core.component.organization.ldap/src/main/java/org/exoplatform/= services/organization/ldap/UserDAOImpl.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- exo.core.component.organization.ldap/src/main/java/org/exoplatform/ser= vices/organization/ldap/UserDAOImpl.java (revision 4450) --===============8264961575137455792==--