exo-jcr SVN: r4465 - core/branches/2.3.x/exo.core.component.ldap/src/main/java/org/exoplatform/services/ldap/impl.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2011-05-31 10:59:54 -0400 (Tue, 31 May 2011)
New Revision: 4465
Modified:
core/branches/2.3.x/exo.core.component.ldap/src/main/java/org/exoplatform/services/ldap/impl/LDAPServiceImpl.java
Log:
EXOJCR-1366 : The patch COR-237.patch was approved and comitted.
Modified: core/branches/2.3.x/exo.core.component.ldap/src/main/java/org/exoplatform/services/ldap/impl/LDAPServiceImpl.java
===================================================================
--- core/branches/2.3.x/exo.core.component.ldap/src/main/java/org/exoplatform/services/ldap/impl/LDAPServiceImpl.java 2011-05-31 14:49:05 UTC (rev 4464)
+++ core/branches/2.3.x/exo.core.component.ldap/src/main/java/org/exoplatform/services/ldap/impl/LDAPServiceImpl.java 2011-05-31 14:59:54 UTC (rev 4465)
@@ -86,6 +86,17 @@
// TODO move it in configuration ?
env.put("com.sun.jndi.ldap.connect.timeout", "60000");
+ if (config.getMinConnection() > 0)
+ {
+ env.put("com.sun.jndi.ldap.connect.pool.initsize", Integer.toString(config.getMinConnection()));
+ env.put("com.sun.jndi.ldap.connect.pool.prefsize", Integer.toString(config.getMinConnection()));
+ }
+
+ if (config.getMaxConnection() > 0)
+ {
+ env.put("com.sun.jndi.ldap.connect.pool.maxsize", Integer.toString(config.getMaxConnection()));
+ }
+
env.put("com.sun.jndi.ldap.connect.pool", "true");
env.put("java.naming.ldap.version", config.getVerion());
env.put("java.naming.ldap.attributes.binary", "tokenGroups");
12 years, 11 months
exo-jcr SVN: r4464 - in core/branches/2.3.x/patch/2.3.10: COR-237 and 1 other directory.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2011-05-31 10:49:05 -0400 (Tue, 31 May 2011)
New Revision: 4464
Added:
core/branches/2.3.x/patch/2.3.10/COR-237/
core/branches/2.3.x/patch/2.3.10/COR-237/COR-237.patch
Log:
EXOJCR-1366 : Patch for cor-2.3.10 was committed in folder with patches
Added: core/branches/2.3.x/patch/2.3.10/COR-237/COR-237.patch
===================================================================
--- core/branches/2.3.x/patch/2.3.10/COR-237/COR-237.patch (rev 0)
+++ core/branches/2.3.x/patch/2.3.10/COR-237/COR-237.patch 2011-05-31 14:49:05 UTC (rev 4464)
@@ -0,0 +1,22 @@
+Index: exo.core.component.ldap/src/main/java/org/exoplatform/services/ldap/impl/LDAPServiceImpl.java
+===================================================================
+--- exo.core.component.ldap/src/main/java/org/exoplatform/services/ldap/impl/LDAPServiceImpl.java (revision 4461)
++++ exo.core.component.ldap/src/main/java/org/exoplatform/services/ldap/impl/LDAPServiceImpl.java (working copy)
+@@ -86,6 +86,17 @@
+ // TODO move it in configuration ?
+ env.put("com.sun.jndi.ldap.connect.timeout", "60000");
+
++ if (config.getMinConnection() > 0)
++ {
++ env.put("com.sun.jndi.ldap.connect.pool.initsize", Integer.toString(config.getMinConnection()));
++ env.put("com.sun.jndi.ldap.connect.pool.prefsize", Integer.toString(config.getMinConnection()));
++ }
++
++ if (config.getMaxConnection() > 0)
++ {
++ env.put("com.sun.jndi.ldap.connect.pool.maxsize", Integer.toString(config.getMaxConnection()));
++ }
++
+ env.put("com.sun.jndi.ldap.connect.pool", "true");
+ env.put("java.naming.ldap.version", config.getVerion());
+ env.put("java.naming.ldap.attributes.binary", "tokenGroups");
12 years, 11 months
exo-jcr SVN: r4463 - in core/branches/2.3.x/patch: 2.3.10 and 1 other directories.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-05-31 10:31:07 -0400 (Tue, 31 May 2011)
New Revision: 4463
Added:
core/branches/2.3.x/patch/2.3.10/
core/branches/2.3.x/patch/2.3.10/COR-34/
core/branches/2.3.x/patch/2.3.10/COR-34/COR-34.patch
Log:
COR-34: patch proposed
Added: core/branches/2.3.x/patch/2.3.10/COR-34/COR-34.patch
===================================================================
--- core/branches/2.3.x/patch/2.3.10/COR-34/COR-34.patch (rev 0)
+++ core/branches/2.3.x/patch/2.3.10/COR-34/COR-34.patch 2011-05-31 14:31:07 UTC (rev 4463)
@@ -0,0 +1,915 @@
+Index: exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/MembershipDAOImpl.java
+===================================================================
+--- exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/MembershipDAOImpl.java (revision 4450)
++++ exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/MembershipDAOImpl.java (working copy)
+@@ -29,6 +29,7 @@
+ import org.exoplatform.services.organization.MembershipType;
+ import org.exoplatform.services.organization.User;
+ import org.exoplatform.services.organization.impl.MembershipImpl;
++import org.exoplatform.services.organization.ldap.CacheHandler.CacheType;
+
+ import java.util.ArrayList;
+ import java.util.Collection;
+@@ -70,12 +71,15 @@
+ * mapping LDAP attributes to eXo organization service items (users, groups, etc)
+ * @param ldapService
+ * {@link LDAPService}
++ * @param cacheHandler
++ * The Cache Handler
+ * @throws Exception
+ * if any errors occurs
+ */
+- public MembershipDAOImpl(LDAPAttributeMapping ldapAttrMapping, LDAPService ldapService) throws Exception
++ public MembershipDAOImpl(LDAPAttributeMapping ldapAttrMapping, LDAPService ldapService, CacheHandler cacheHandler)
++ throws Exception
+ {
+- super(ldapAttrMapping, ldapService);
++ super(ldapAttrMapping, ldapService, cacheHandler);
+ this.listeners = new ArrayList<MembershipEventListener>(3);
+ }
+
+@@ -131,6 +135,8 @@
+ ctx.createSubcontext(membershipDN, ldapAttrMapping.membershipToAttributes(m, userDN));
+ if (broadcast)
+ postSave(m, true);
++
++ cacheHandler.put(cacheHandler.getMembershipKey(m), m, CacheType.MEMBERSHIP);
+ return;
+ }
+ // if contains membership
+@@ -148,6 +154,8 @@
+ ctx.modifyAttributes(membershipDN, mods);
+ if (broadcast)
+ postSave(m, true);
++
++ cacheHandler.put(cacheHandler.getMembershipKey(m), m, CacheType.MEMBERSHIP);
+ return;
+
+ }
+@@ -245,14 +253,19 @@
+ ctx.modifyAttributes(membershipDN, mods);
+ if (broadcast)
+ postSave(m, true);
++
++ cacheHandler.put(cacheHandler.getMembershipKey(m), m, CacheType.MEMBERSHIP);
+ }
+ else
+ {
+ if (broadcast)
+ preDelete(m);
+ ctx.destroySubcontext(membershipDN);
++
+ if (broadcast)
+ postDelete(m);
++
++ cacheHandler.remove(cacheHandler.getMembershipKey(m), CacheType.MEMBERSHIP);
+ }
+ return m;
+ }
+@@ -318,9 +331,13 @@
+ new ModificationItem(DirContext.REMOVE_ATTRIBUTE, new BasicAttribute(
+ ldapAttrMapping.membershipTypeMemberValue, userDN));
+ ctx.modifyAttributes(membershipDN, mods);
++ cacheHandler.put(cacheHandler.getMembershipKey(membership), membership, CacheType.MEMBERSHIP);
+ }
+ else
++ {
+ ctx.destroySubcontext(membershipDN);
++ cacheHandler.remove(cacheHandler.getMembershipKey(membership), CacheType.MEMBERSHIP);
++ }
+ }
+ catch (Exception e1)
+ {
+@@ -365,12 +382,19 @@
+ */
+ public Membership findMembershipByUserGroupAndType(String userName, String groupId, String type) throws Exception
+ {
++ MembershipImpl membership =
++ (MembershipImpl)cacheHandler.get(cacheHandler.getMembershipKey(userName, groupId, type), CacheType.MEMBERSHIP);
++ if (membership != null)
++ {
++ return membership;
++ }
++
+ LdapContext ctx = ldapService.getLdapContext();
+ try
+ {
+ for (int err = 0;; err++)
+ {
+- Membership membership = null;
++ membership = null;
+ try
+ {
+ String userDN = getDNFromUsername(ctx, userName);
+@@ -395,6 +419,10 @@
+ membership = createMembershipObject(userName, groupId, type);
+ }
+
++ if (membership != null)
++ {
++ cacheHandler.put(cacheHandler.getMembershipKey(membership), membership, CacheType.MEMBERSHIP);
++ }
+ return membership;
+ }
+ catch (NamingException e)
+@@ -538,9 +566,9 @@
+ {
+ SearchResult sr = results.next();
+ String membershipDN = sr.getNameInNamespace();
+- Group group = getGroupFromMembershipDN(ctx, membershipDN);
++ String groupId = getGroupIdFromGroupDN(getGroupDNFromMembershipDN(membershipDN));
+ String type = explodeDN(membershipDN, true)[0];
+- Membership membership = createMembershipObject(userName, group.getId(), type);
++ Membership membership = createMembershipObject(userName, groupId, type);
+ memberships.add(membership);
+ }
+ if (LOG.isDebugEnabled())
+Index: exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/GroupDAOImpl.java
+===================================================================
+--- exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/GroupDAOImpl.java (revision 4450)
++++ exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/GroupDAOImpl.java (working copy)
+@@ -26,11 +26,14 @@
+ import org.exoplatform.services.organization.GroupEventListenerHandler;
+ import org.exoplatform.services.organization.GroupHandler;
+ import org.exoplatform.services.organization.impl.GroupImpl;
++import org.exoplatform.services.organization.ldap.CacheHandler.CacheType;
+
+ import java.util.ArrayList;
+ import java.util.Collection;
+ import java.util.Collections;
++import java.util.HashSet;
+ import java.util.List;
++import java.util.Set;
+
+ import javax.naming.CompositeName;
+ import javax.naming.Name;
+@@ -69,11 +72,14 @@
+ * @param ldapAttrMapping mapping LDAP attributes to eXo organization service
+ * items (users, groups, etc)
+ * @param ldapService {@link LDAPService}
++ * @param cacheHandler
++ * The Cache Handler
+ * @throws Exception if any errors occurs
+ */
+- public GroupDAOImpl(LDAPAttributeMapping ldapAttrMapping, LDAPService ldapService) throws Exception
++ public GroupDAOImpl(LDAPAttributeMapping ldapAttrMapping, LDAPService ldapService, CacheHandler cacheHandler)
++ throws Exception
+ {
+- super(ldapAttrMapping, ldapService);
++ super(ldapAttrMapping, ldapService, cacheHandler);
+ this.listeners = new ArrayList<GroupEventListener>(3);
+ }
+
+@@ -136,6 +142,8 @@
+ ctx.createSubcontext(groupDN, ldapAttrMapping.groupToAttributes(child));
+ if (broadcast)
+ postSave(group, true);
++
++ cacheHandler.put(child.getId(), group, CacheType.GROUP);
+ return;
+ }
+ catch (NamingException e)
+@@ -192,6 +200,8 @@
+ ctx.modifyAttributes(groupDN, mods);
+ if (broadcast)
+ postSave(group, true);
++
++ cacheHandler.put(group.getId(), group, CacheType.GROUP);
+ return;
+ }
+ catch (NamingException e)
+@@ -255,6 +265,7 @@
+ removeAllSubtree(ctx, groupDN);
+ if (broadcast)
+ postDelete(group);
++
+ return group;
+
+ }
+@@ -348,6 +359,13 @@
+ {
+ if (groupId == null)
+ return null;
++
++ Group group = (Group)cacheHandler.get(groupId, CacheType.GROUP);
++ if (group != null)
++ {
++ return group;
++ }
++
+ String parentId = null;
+ StringBuffer buffer = new StringBuffer();
+ String[] groupIdParts = groupId.split("/");
+@@ -366,9 +384,14 @@
+ try
+ {
+ Attributes attrs = ctx.getAttributes(groupDN);
+- Group group = ldapAttrMapping.attributesToGroup(attrs);
++ group = ldapAttrMapping.attributesToGroup(attrs);
+ ((GroupImpl)group).setId(groupId);
+ ((GroupImpl)group).setParentId(parentId);
++
++ if (group != null)
++ {
++ cacheHandler.put(groupId, group, CacheType.GROUP);
++ }
+ return group;
+ }
+ catch (NamingException e)
+@@ -402,6 +425,13 @@
+ {
+ if (groupId == null)
+ return null;
++
++ Group group = (Group)cacheHandler.get(groupId, CacheType.GROUP);
++ if (group != null)
++ {
++ return group;
++ }
++
+ String parentId = null;
+ StringBuffer buffer = new StringBuffer();
+ String[] groupIdParts = groupId.split("/");
+@@ -415,9 +445,14 @@
+ try
+ {
+ Attributes attrs = ctx.getAttributes(groupDN);
+- Group group = ldapAttrMapping.attributesToGroup(attrs);
++ group = ldapAttrMapping.attributesToGroup(attrs);
+ ((GroupImpl)group).setId(groupId);
+ ((GroupImpl)group).setParentId(parentId);
++
++ if (group != null)
++ {
++ cacheHandler.put(groupId, group, CacheType.GROUP);
++ }
+ return group;
+ }
+ catch (NameNotFoundException e)
+@@ -473,7 +508,7 @@
+ {
+ Name entryName = parser.parse(name.get(0));
+ String groupDN = entryName + "," + ldapAttrMapping.groupsURL;
+- Group group = this.getGroupByDN(ctx, groupDN);
++ Group group = this.buildGroup(groupDN, sr.getAttributes());
+ if (group != null)
+ addGroup(groups, group);
+ }
+@@ -555,7 +590,7 @@
+ {
+ Name entryName = parser.parse(name.get(0));
+ String groupDN = entryName + "," + searchBase;
+- Group group = this.getGroupByDN(ctx, groupDN);
++ Group group = this.buildGroup(groupDN, sr.getAttributes());
+ if (group != null)
+ addGroup(groups, group);
+ }
+@@ -613,21 +648,24 @@
+ results = ctx.search(ldapAttrMapping.groupsURL, filter, constraints);
+
+ // add groups for memberships matching user
+- // int total = 0;
++ Set<String> uniqueGroupsDN = new HashSet<String>();
+ while (results != null && results.hasMore())
+ {
+ SearchResult sr = results.next();
+- // total++;
+ NameParser parser = ctx.getNameParser("");
+ CompositeName name = new CompositeName(sr.getName());
+ if (name.size() < 1)
+ break;
+ Name entryName = parser.parse(name.get(0));
+ String membershipDN = entryName + "," + ldapAttrMapping.groupsURL;
+- Group group = this.getGroupFromMembershipDN(ctx, membershipDN);
+- if (group != null)
+- addGroup(groups, group);
++ uniqueGroupsDN.add(this.getGroupDNFromMembershipDN(membershipDN));
+ }
++ for(String groupDN : uniqueGroupsDN)
++ {
++ Group group = this.getGroupByDN(ctx, groupDN);
++ if (group != null)
++ addGroup(groups, group);
++ }
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Retrieved " + groups.size() + " groups from ldap for user " + userName);
+Index: exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/MembershipTypeDAOImpl.java
+===================================================================
+--- exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/MembershipTypeDAOImpl.java (revision 4450)
++++ exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/MembershipTypeDAOImpl.java (working copy)
+@@ -24,6 +24,7 @@
+ import org.exoplatform.services.organization.MembershipType;
+ import org.exoplatform.services.organization.MembershipTypeHandler;
+ import org.exoplatform.services.organization.impl.MembershipTypeImpl;
++import org.exoplatform.services.organization.ldap.CacheHandler.CacheType;
+
+ import java.util.ArrayList;
+ import java.util.Collection;
+@@ -56,11 +57,14 @@
+ * @param ldapAttrMapping mapping LDAP attributes to eXo organization service
+ * items (users, groups, etc)
+ * @param ldapService {@link LDAPService}
++ * @param cacheHandler
++ * The Cache Handler
+ * @throws Exception if any errors occurs
+ */
+- public MembershipTypeDAOImpl(LDAPAttributeMapping ldapAttrMapping, LDAPService ldapService) throws Exception
++ public MembershipTypeDAOImpl(LDAPAttributeMapping ldapAttrMapping, LDAPService ldapService, CacheHandler cacheHandler)
++ throws Exception
+ {
+- super(ldapAttrMapping, ldapService);
++ super(ldapAttrMapping, ldapService, cacheHandler);
+ }
+
+ /**
+@@ -95,6 +99,8 @@
+ mt.setCreatedDate(now);
+ mt.setModifiedDate(now);
+ ctx.createSubcontext(membershipTypeDN, ldapAttrMapping.membershipTypeToAttributes(mt));
++
++ cacheHandler.put(mt.getName(), mt, CacheType.MEMBERSHIPTYPE);
+ }
+ return mt;
+ }
+@@ -146,6 +152,8 @@
+ ldapAttrMapping.ldapDescriptionAttr, mt.getDescription()));
+ }
+ ctx.modifyAttributes(membershipTypeDN, mods);
++
++ cacheHandler.put(mt.getName(), mt, CacheType.MEMBERSHIPTYPE);
+ return mt;
+ }
+ catch (NamingException e)
+@@ -181,6 +189,8 @@
+ MembershipType m = ldapAttrMapping.attributesToMembershipType(attrs);
+ removeMembership(ctx, name);
+ ctx.destroySubcontext(membershipTypeDN);
++
++ cacheHandler.remove(name, CacheType.MEMBERSHIPTYPE);
+ return m;
+ }
+ catch (NamingException e)
+@@ -209,6 +219,12 @@
+ */
+ public MembershipType findMembershipType(String name) throws Exception
+ {
++ MembershipType mt = (MembershipType)cacheHandler.get(name, CacheType.MEMBERSHIPTYPE);
++ if (mt != null)
++ {
++ return mt;
++ }
++
+ String membershipTypeDN =
+ ldapAttrMapping.membershipTypeNameAttr + "=" + name + "," + ldapAttrMapping.membershipTypeURL;
+ LdapContext ctx = ldapService.getLdapContext();
+@@ -219,7 +235,12 @@
+ try
+ {
+ Attributes attrs = ctx.getAttributes(membershipTypeDN);
+- return ldapAttrMapping.attributesToMembershipType(attrs);
++ mt = ldapAttrMapping.attributesToMembershipType(attrs);
++ if (mt != null)
++ {
++ cacheHandler.put(name, mt, CacheType.MEMBERSHIPTYPE);
++ }
++ return mt;
+ }
+ catch (NamingException e)
+ {
+@@ -307,6 +328,8 @@
+ {
+ SearchResult sr = results.next();
+ ctx.destroySubcontext(sr.getNameInNamespace());
++
++ cacheHandler.remove(CacheHandler.MEMBERSHIPTYPE_PREFIX + name, CacheType.MEMBERSHIP);
+ }
+ }
+ finally
+Index: exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/UserProfileDAOImpl.java
+===================================================================
+--- exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/UserProfileDAOImpl.java (revision 4450)
++++ exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/UserProfileDAOImpl.java (working copy)
+@@ -61,9 +61,10 @@
+ */
+ private static final Log LOG = ExoLogger.getLogger("exo.core.component.organization.ldap.UserProfileDAOImpl");
+
+- public UserProfileDAOImpl(LDAPAttributeMapping ldapAttrMapping, LDAPService ldapService) throws Exception
++ public UserProfileDAOImpl(LDAPAttributeMapping ldapAttrMapping, LDAPService ldapService, CacheHandler cacheHandler)
++ throws Exception
+ {
+- super(ldapAttrMapping, ldapService);
++ super(ldapAttrMapping, ldapService, cacheHandler);
+ this.listeners = new ArrayList<UserProfileEventListener>(3);
+ }
+
+Index: exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/ADMembershipDAOImpl.java
+===================================================================
+--- exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/ADMembershipDAOImpl.java (revision 4450)
++++ exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/ADMembershipDAOImpl.java (working copy)
+@@ -22,6 +22,7 @@
+ import org.exoplatform.services.organization.Group;
+ import org.exoplatform.services.organization.Membership;
+ import org.exoplatform.services.organization.impl.MembershipImpl;
++import org.exoplatform.services.organization.ldap.CacheHandler.CacheType;
+
+ import java.util.ArrayList;
+ import java.util.Collection;
+@@ -48,12 +49,14 @@
+ * items
+ * @param ldapService {@link LDAPService}
+ * @param ad See {@link ADSearchBySID}
++ * @param cacheHandler
++ * The Cache Handler
+ * @throws Exception if any errors occurs
+ */
+- public ADMembershipDAOImpl(LDAPAttributeMapping ldapAttrMapping, LDAPService ldapService, ADSearchBySID ad)
+- throws Exception
++ public ADMembershipDAOImpl(LDAPAttributeMapping ldapAttrMapping, LDAPService ldapService, ADSearchBySID ad,
++ CacheHandler cacheHandler) throws Exception
+ {
+- super(ldapAttrMapping, ldapService);
++ super(ldapAttrMapping, ldapService, cacheHandler);
+ adSearch = ad;
+ }
+
+@@ -64,6 +67,13 @@
+ @Override
+ public Membership findMembershipByUserGroupAndType(String userName, String groupId, String type) throws Exception
+ {
++ MembershipImpl membership =
++ (MembershipImpl)cacheHandler.get(cacheHandler.getMembershipKey(userName, groupId, type), CacheType.MEMBERSHIP);
++ if (membership != null)
++ {
++ return membership;
++ }
++
+ LdapContext ctx = ldapService.getLdapContext(true);
+ String groupDN = getGroupDNFromGroupId(groupId);
+ try
+@@ -74,7 +84,11 @@
+ {
+ Collection memberships = findMemberships(ctx, userName, groupDN, type);
+ if (memberships.size() > 0)
+- return (MembershipImpl)memberships.iterator().next();
++ {
++ membership = (MembershipImpl)memberships.iterator().next();
++ cacheHandler.put(cacheHandler.getMembershipKey(membership), membership, CacheType.MEMBERSHIP);
++ return membership;
++ }
+ return null;
+ }
+ catch (NamingException e)
+@@ -184,7 +198,7 @@
+ results = ctx.search(userDN, filter, constraints);
+ while (results.hasMore())
+ {
+- SearchResult sr = (SearchResult)results.next();
++ SearchResult sr = results.next();
+ Attributes attrs = sr.getAttributes();
+ Attribute attr = attrs.get("tokenGroups");
+ for (int x = 0; x < attr.size(); x++)
+Index: exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/ADGroupDAOImpl.java
+===================================================================
+--- exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/ADGroupDAOImpl.java (revision 4450)
++++ exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/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, LDAPService ldapService, ADSearchBySID ad)
+- throws Exception
++ public ADGroupDAOImpl(LDAPAttributeMapping ldapAttrMapping, LDAPService ldapService, ADSearchBySID ad,
++ CacheHandler cacheHandler) throws Exception
+ {
+- super(ldapAttrMapping, ldapService);
++ super(ldapAttrMapping, ldapService, cacheHandler);
+ adSearch = ad;
+ }
+
+Index: exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/OrganizationServiceImpl.java
+===================================================================
+--- exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/OrganizationServiceImpl.java (revision 4450)
++++ exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/OrganizationServiceImpl.java (working copy)
+@@ -47,25 +47,27 @@
+ LDAPAttributeMapping ldapAttrMapping =
+ (LDAPAttributeMapping)params.getObjectParam("ldap.attribute.mapping").getObject();
+
++ CacheHandler cacheHandler = new CacheHandler(cservice);
++
+ if (ldapService.getServerType() == LDAPService.ACTIVE_DIRECTORY_SERVER)
+ {
+- userDAO_ = new ADUserDAOImpl(ldapAttrMapping, ldapService);
++ userDAO_ = new ADUserDAOImpl(ldapAttrMapping, ldapService, cacheHandler);
+ // ADSearchBySID adSearch = new ADSearchBySID(ldapAttrMapping, ldapService);
+ ADSearchBySID adSearch = new ADSearchBySID(ldapAttrMapping);
+- groupDAO_ = new ADGroupDAOImpl(ldapAttrMapping, ldapService, adSearch);
+- membershipDAO_ = new ADMembershipDAOImpl(ldapAttrMapping, ldapService, adSearch);
++ groupDAO_ = new ADGroupDAOImpl(ldapAttrMapping, ldapService, adSearch, cacheHandler);
++ membershipDAO_ = new ADMembershipDAOImpl(ldapAttrMapping, ldapService, adSearch, cacheHandler);
+ }
+ else
+ {
+ // ValueParam param = params.getValueParam("ldap.userDN.key");
+ // ldapAttrMapping.userDNKey = param.getValue();
+- userDAO_ = new UserDAOImpl(ldapAttrMapping, ldapService);
+- groupDAO_ = new GroupDAOImpl(ldapAttrMapping, ldapService);
+- membershipDAO_ = new MembershipDAOImpl(ldapAttrMapping, ldapService);
++ userDAO_ = new UserDAOImpl(ldapAttrMapping, ldapService, cacheHandler);
++ groupDAO_ = new GroupDAOImpl(ldapAttrMapping, ldapService, cacheHandler);
++ membershipDAO_ = new MembershipDAOImpl(ldapAttrMapping, ldapService, cacheHandler);
+ }
+ // userProfileHandler_ = new UserProfileHandlerImpl(ldapAttrMapping, ldapService) ;
+ userProfileDAO_ = new UserProfileDAOImpl(hservice, cservice);
+- membershipTypeDAO_ = new MembershipTypeDAOImpl(ldapAttrMapping, ldapService);
++ membershipTypeDAO_ = new MembershipTypeDAOImpl(ldapAttrMapping, ldapService, cacheHandler);
+
+ ValueParam param = params.getValueParam("ldap.userDN.key");
+ if (param != null)
+Index: exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/UserDAOImpl.java
+===================================================================
+--- exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/UserDAOImpl.java (revision 4450)
++++ exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/UserDAOImpl.java (working copy)
+@@ -21,8 +21,13 @@
+ import org.exoplatform.commons.utils.LazyPageList;
+ import org.exoplatform.commons.utils.ListAccess;
+ import org.exoplatform.services.ldap.LDAPService;
+-import org.exoplatform.services.organization.*;
++import org.exoplatform.services.organization.Query;
++import org.exoplatform.services.organization.User;
++import org.exoplatform.services.organization.UserEventListener;
++import org.exoplatform.services.organization.UserEventListenerHandler;
++import org.exoplatform.services.organization.UserHandler;
+ import org.exoplatform.services.organization.impl.UserImpl;
++import org.exoplatform.services.organization.ldap.CacheHandler.CacheType;
+
+ import java.util.ArrayList;
+ import java.util.Collections;
+@@ -53,11 +58,14 @@
+ * @param ldapAttrMapping mapping LDAP attributes to eXo organization service
+ * items (users, groups, etc)
+ * @param ldapService {@link LDAPService}
++ * @param cacheHandler
++ * The Cache Handler
+ * @throws Exception if any errors occurs
+ */
+- public UserDAOImpl(LDAPAttributeMapping ldapAttrMapping, LDAPService ldapService) throws Exception
++ public UserDAOImpl(LDAPAttributeMapping ldapAttrMapping, LDAPService ldapService, CacheHandler cacheHandler)
++ throws Exception
+ {
+- super(ldapAttrMapping, ldapService);
++ super(ldapAttrMapping, ldapService, cacheHandler);
+ }
+
+ /**
+@@ -104,6 +112,8 @@
+ ctx.createSubcontext(userDN, attrs);
+ if (broadcast)
+ postSave(user, true);
++
++ cacheHandler.put(user.getUserName(), user, CacheType.USER);
+ break;
+ }
+ catch (NamingException e)
+@@ -145,6 +155,8 @@
+ ctx.modifyAttributes(userDN, mods);
+ if (broadcast)
+ postSave(user, false);
++
++ cacheHandler.put(user.getUserName(), user, CacheType.USER);
+ break;
+ }
+ catch (NamingException e)
+@@ -174,7 +186,7 @@
+ * @param userDN Distinguished Name
+ * @throws Exception if any errors occurs
+ */
+- void saveUserPassword(User user, String userDN) throws Exception
++ protected void saveUserPassword(User user, String userDN) throws Exception
+ {
+ ModificationItem[] mods =
+ new ModificationItem[]{new ModificationItem(DirContext.REPLACE_ATTRIBUTE, new BasicAttribute(
+@@ -227,6 +239,9 @@
+ ctx.destroySubcontext(userDN);
+ if (broadcast)
+ postDelete(user);
++
++ cacheHandler.remove(userName, CacheType.USER);
++ cacheHandler.remove(CacheHandler.USER_PREFIX + userName, CacheType.MEMBERSHIP);
+ return user;
+ }
+ catch (NamingException e)
+@@ -249,6 +264,12 @@
+ */
+ public User findUserByName(String userName) throws Exception
+ {
++ User user = (User)cacheHandler.get(userName, CacheType.USER);
++ if (user != null)
++ {
++ return user;
++ }
++
+ LdapContext ctx = ldapService.getLdapContext();
+ try
+ {
+@@ -256,7 +277,12 @@
+ {
+ try
+ {
+- return getUserFromUsername(ctx, userName);
++ user = getUserFromUsername(ctx, userName);
++ if (user != null)
++ {
++ cacheHandler.put(user.getUserName(), user, CacheType.USER);
++ }
++ return user;
+ }
+ catch (NamingException e)
+ {
+@@ -283,51 +309,6 @@
+ */
+ public ListAccess<User> findUsersByGroupId(String groupId) throws Exception
+ {
+- // ArrayList<User> users = new ArrayList<User>();
+- // TreeMap<String, User> map = new TreeMap<String, User>();
+- //
+- // LdapContext ctx = ldapService.getLdapContext();
+- // try {
+- // NamingEnumeration<SearchResult> results = null;
+- // for (int err = 0;; err++) {
+- // map.clear();
+- // try {
+- // String searchBase = this.getGroupDNFromGroupId(groupId);
+- // String filter = ldapAttrMapping.membershipObjectClassFilter;
+- // SearchControls constraints = new SearchControls();
+- // constraints.setSearchScope(SearchControls.ONELEVEL_SCOPE);
+- // results = ctx.search(searchBase, filter, constraints);
+- // while (results.hasMoreElements()) {
+- // SearchResult sr = results.next();
+- // Attributes attrs = sr.getAttributes();
+- // List<Object> members = this.getAttributes(attrs,
+- // ldapAttrMapping.membershipTypeMemberValue);
+- // for (int x = 0; x < members.size(); x++) {
+- // User user = findUserByDN(ctx, (String) members.get(x));
+- // if (user != null)
+- // map.put(user.getUserName(), user);
+- // }
+- // }
+- // break;
+- // } catch (NamingException e) {
+- // if (isConnectionError(e) && err < getMaxConnectionError())
+- // ctx = ldapService.getLdapContext(true);
+- // else
+- // throw e;
+- // } finally {
+- // if (results != null)
+- // results.close();
+- // }
+- // }
+- // } finally {
+- // ldapService.release(ctx);
+- // }
+- //
+- // for (Iterator<String> i = map.keySet().iterator(); i.hasNext();)
+- // users.add(map.get(i.next()));
+- //
+- // return new ObjectPageList(users, 10);
+-
+ String searchBase = this.getGroupDNFromGroupId(groupId);
+ String filter = ldapAttrMapping.membershipObjectClassFilter;
+ return new ByGroupLdapUserListAccess(ldapAttrMapping, ldapService, searchBase, filter);
+@@ -346,8 +327,6 @@
+ String searchBase = ldapAttrMapping.userURL;
+ String filter = ldapAttrMapping.userObjectClassFilter;
+
+- // return new LDAPUserPageList(ldapAttrMapping, ldapService, searchBase, filter, pageSize);
+-
+ return new SimpleLdapUserListAccess(ldapAttrMapping, ldapService, searchBase, filter);
+ }
+
+Index: exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/ADUserDAOImpl.java
+===================================================================
+--- exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/ADUserDAOImpl.java (revision 4450)
++++ exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/ADUserDAOImpl.java (working copy)
+@@ -20,6 +20,7 @@
+
+ import org.exoplatform.services.ldap.LDAPService;
+ import org.exoplatform.services.organization.User;
++import org.exoplatform.services.organization.ldap.CacheHandler.CacheType;
+
+ import javax.naming.Context;
+ import javax.naming.NamingException;
+@@ -61,11 +62,14 @@
+ /**
+ * @param ldapAttrMapping {@link LDAPAttributeMapping}
+ * @param ldapService {@link LDAPService}
++ * @param cservice
++ * The Cache Handler
+ * @throws Exception if any errors occurs
+ */
+- public ADUserDAOImpl(LDAPAttributeMapping ldapAttrMapping, LDAPService ldapService) throws Exception
++ public ADUserDAOImpl(LDAPAttributeMapping ldapAttrMapping, LDAPService ldapService, CacheHandler cacheHandler)
++ throws Exception
+ {
+- super(ldapAttrMapping, ldapService);
++ super(ldapAttrMapping, ldapService, cacheHandler);
+ LDAPUserPageList.SEARCH_CONTROL = Control.CRITICAL;
+ }
+
+@@ -93,6 +97,8 @@
+ ctx.createSubcontext(userDN, attrs);
+ if (broadcast)
+ postSave(user, true);
++
++ cacheHandler.put(user.getUserName(), user, CacheType.USER);
+ break;
+ }
+ catch (NamingException e)
+@@ -118,7 +124,7 @@
+ * {@inheritDoc}
+ */
+ @Override
+- void saveUserPassword(User user, String userDN) throws Exception
++ protected void saveUserPassword(User user, String userDN) throws Exception
+ {
+ Object v = ldapService.getLdapContext().getEnvironment().get(Context.SECURITY_PROTOCOL);
+ if (v == null)
+Index: exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/BaseDAO.java
+===================================================================
+--- exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/BaseDAO.java (revision 4450)
++++ exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/BaseDAO.java (working copy)
+@@ -24,6 +24,7 @@
+ import org.exoplatform.services.organization.Group;
+ import org.exoplatform.services.organization.User;
+ import org.exoplatform.services.organization.impl.GroupImpl;
++import org.exoplatform.services.organization.ldap.CacheHandler.CacheType;
+
+ import java.util.ArrayList;
+ import java.util.Enumeration;
+@@ -82,14 +83,21 @@
+ private static int maxConnectionError = -1;
+
+ /**
++ * The Cache Handler.
++ */
++ protected final CacheHandler cacheHandler;
++
++ /**
+ * @param ldapAttrMapping {@link LDAPAttributeMapping}
+ * @param ldapService {@link LDAPService}
+ * @throws Exception if any error occurs
+ */
+- public BaseDAO(LDAPAttributeMapping ldapAttrMapping, LDAPService ldapService) throws Exception
++ public BaseDAO(LDAPAttributeMapping ldapAttrMapping, LDAPService ldapService, CacheHandler cacheHandler)
++ throws Exception
+ {
+ this.ldapAttrMapping = ldapAttrMapping;
+ this.ldapService = ldapService;
++ this.cacheHandler = cacheHandler;
+ initializeNameParser();
+ }
+
+@@ -141,6 +149,26 @@
+ }
+
+ /**
++ * Construct object name from {@link Group} id.
++ *
++ * @param groupDN group DN
++ * @return object name
++ */
++ protected String getGroupIdFromGroupDN(String groupDN) throws NamingException
++ {
++ // extract group's id, group's name and parent's group from DN
++ StringBuffer buffer = new StringBuffer();
++ String[] baseParts = explodeDN(ldapAttrMapping.groupsURL, true);
++ String[] membershipParts = explodeDN(groupDN, true);
++ for (int x = (membershipParts.length - baseParts.length - 1); x > -1; x--)
++ {
++ buffer.append("/" + membershipParts[x]);
++ }
++
++ return buffer.toString();
++ }
++
++ /**
+ * Get collection of {@link Attribute} with specified name from
+ * {@link Attributes}.
+ *
+@@ -204,6 +232,20 @@
+ */
+ protected Group getGroupFromMembershipDN(LdapContext ctx, String membershipDN) throws NamingException
+ {
++ String groupDN = getGroupDNFromMembershipDN(membershipDN);
++ Group group = getGroupByDN(ctx, groupDN);
++ return group;
++ }
++
++ /**
++ * Retrieve Group DN from membership DN.
++ *
++ * @param membershipDN membership Distinguished Name
++ * @return GroupDN
++ * @throws NamingException if any naming errors occurs
++ */
++ protected String getGroupDNFromMembershipDN(String membershipDN) throws NamingException
++ {
+ String[] membershipParts = explodeDN(membershipDN, false);
+ StringBuffer buffer = new StringBuffer();
+ for (int x = 1; x < membershipParts.length; x++)
+@@ -217,8 +259,7 @@
+ buffer.append(membershipParts[x] + ",");
+ }
+ }
+- Group group = getGroupByDN(ctx, buffer.toString());
+- return group;
++ return buffer.toString();
+ }
+
+ /**
+@@ -270,6 +311,26 @@
+ */
+ protected Group getGroupByDN(LdapContext ctx, String groupDN) throws NamingException
+ {
++ try
++ {
++ Attributes attrs = ctx.getAttributes(groupDN);
++ return buildGroup(groupDN, attrs);
++ }
++ catch (NameNotFoundException e)
++ {
++ if (LOG.isDebugEnabled())
++ e.printStackTrace();
++ // Object with specified Distinguished Name not found. Null will be
++ // returned. This result we regard as successful, just nothing found.
++ return null;
++ }
++ }
++
++ protected Group buildGroup(String groupDN, Attributes attrs) throws NamingException
++ {
++ GroupImpl group = new GroupImpl();
++
++ // extract group's id, group's name and parent's group from DN
+ StringBuffer idBuffer = new StringBuffer();
+ String parentId = null;
+ String[] baseParts = explodeDN(ldapAttrMapping.groupsURL, true);
+@@ -280,25 +341,17 @@
+ if (x == 1)
+ parentId = idBuffer.toString();
+ }
+- try
++
++ group.setGroupName(membershipParts[0]);
++ group.setId(idBuffer.toString());
++ if (attrs != null)
+ {
+- Attributes attrs = ctx.getAttributes(groupDN);
+- GroupImpl group = new GroupImpl();
+- group.setGroupName(membershipParts[0]);
+- group.setId(idBuffer.toString());
+ group.setDescription(ldapAttrMapping.getAttributeValueAsString(attrs, ldapAttrMapping.ldapDescriptionAttr));
+ group.setLabel(ldapAttrMapping.getAttributeValueAsString(attrs, ldapAttrMapping.groupLabelAttr));
+- group.setParentId(parentId);
+- return group;
+ }
+- catch (NameNotFoundException e)
+- {
+- if (LOG.isDebugEnabled())
+- e.printStackTrace();
+- // Object with specified Distinguished Name not found. Null will be
+- // returned. This result we regard as successful, just nothing found.
+- return null;
+- }
++ group.setParentId(parentId);
++
++ return group;
+ }
+
+ /**
+@@ -381,9 +434,7 @@
+ answer = findUser(ctx, username, true);
+ while (answer.hasMoreElements())
+ {
+- String userDN = answer.next().getNameInNamespace();
+- Attributes attrs = ctx.getAttributes(userDN);
+- return ldapAttrMapping.attributesToUser(attrs);
++ return ldapAttrMapping.attributesToUser(answer.next().getAttributes());
+ }
+ return null;
+ }
+@@ -525,6 +576,10 @@
+ removeAllSubtree(ctx, sr.getNameInNamespace());
+ }
+ ctx.destroySubcontext(dn);
++
++ String groupId = buildGroup(dn, null).getId();
++ cacheHandler.remove(groupId, CacheType.GROUP);
++ cacheHandler.remove(CacheHandler.GROUP_PREFIX + groupId, CacheType.MEMBERSHIP);
+ }
+ finally
+ {
12 years, 11 months
exo-jcr SVN: r4462 - core/trunk/exo.core.component.ldap/src/main/java/org/exoplatform/services/ldap/impl.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2011-05-31 10:28:59 -0400 (Tue, 31 May 2011)
New Revision: 4462
Modified:
core/trunk/exo.core.component.ldap/src/main/java/org/exoplatform/services/ldap/impl/LDAPServiceImpl.java
Log:
EXOJCR-1366 : minConnection and maxConnection params in the ldap configuration was used
Modified: core/trunk/exo.core.component.ldap/src/main/java/org/exoplatform/services/ldap/impl/LDAPServiceImpl.java
===================================================================
--- core/trunk/exo.core.component.ldap/src/main/java/org/exoplatform/services/ldap/impl/LDAPServiceImpl.java 2011-05-31 09:54:35 UTC (rev 4461)
+++ core/trunk/exo.core.component.ldap/src/main/java/org/exoplatform/services/ldap/impl/LDAPServiceImpl.java 2011-05-31 14:28:59 UTC (rev 4462)
@@ -87,6 +87,17 @@
// TODO move it in configuration ?
env.put("com.sun.jndi.ldap.connect.timeout", "60000");
+ if (config.getMinConnection() > 0)
+ {
+ env.put("com.sun.jndi.ldap.connect.pool.initsize", Integer.toString(config.getMinConnection()));
+ env.put("com.sun.jndi.ldap.connect.pool.prefsize", Integer.toString(config.getMinConnection()));
+ }
+
+ if (config.getMaxConnection() > 0)
+ {
+ env.put("com.sun.jndi.ldap.connect.pool.maxsize", Integer.toString(config.getMaxConnection()));
+ }
+
env.put("com.sun.jndi.ldap.connect.pool", "true");
env.put("java.naming.ldap.version", config.getVerion());
env.put("java.naming.ldap.attributes.binary", "tokenGroups");
12 years, 11 months
exo-jcr SVN: r4461 - in jcr/branches/1.12.x: exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/util and 2 other directories.
by do-not-reply@jboss.org
Author: paristote
Date: 2011-05-31 05:54:35 -0400 (Tue, 31 May 2011)
New Revision: 4461
Modified:
jcr/branches/1.12.x/exo.jcr.component.core/pom.xml
jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/util/TesterConfigurationHelper.java
jcr/branches/1.12.x/exo.jcr.component.core/src/test/resources/log4j.properties
jcr/branches/1.12.x/exo.jcr.component.webdav/pom.xml
Log:
JCR-1632 clean build by putting all generated data in target
Modified: jcr/branches/1.12.x/exo.jcr.component.core/pom.xml
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/pom.xml 2011-05-31 09:36:56 UTC (rev 4460)
+++ jcr/branches/1.12.x/exo.jcr.component.core/pom.xml 2011-05-31 09:54:35 UTC (rev 4461)
@@ -364,7 +364,7 @@
<overWrite>false</overWrite>
</artifactItem>
</artifactItems>
- <outputDirectory>${project.build.testSourceDirectory}</outputDirectory>
+ <outputDirectory>${project.build.directory}/jackrabbit-jcr-tests</outputDirectory>
</configuration>
</execution>
</executions>
@@ -373,7 +373,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <argLine>${env.MAVEN_OPTS}</argLine>
+ <argLine>${env.MAVEN_OPTS} -Dcom.arjuna.ats.arjuna.objectstore.objectStoreDir=${project.build.directory}</argLine>
<systemProperties>
<property>
<name>jcr.test.configuration.file</name>
@@ -558,7 +558,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!-- TAKE CARE TO UPDATE ALSO run-all PROFILE -->
- <argLine>${env.MAVEN_OPTS}</argLine>
+ <argLine>${env.MAVEN_OPTS} -Dcom.arjuna.ats.arjuna.objectstore.objectStoreDir=${project.build.directory}</argLine>
<systemProperties>
<property>
<name>jcr.test.configuration.file</name>
@@ -645,7 +645,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!-- TAKE CARE TO UPDATE ALSO run-tck PROFILE -->
- <argLine>${env.MAVEN_OPTS}</argLine>
+ <argLine>${env.MAVEN_OPTS} -Dcom.arjuna.ats.arjuna.objectstore.objectStoreDir=${project.build.directory}</argLine>
<systemProperties>
<property>
<name>jcr.test.configuration.file</name>
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/util/TesterConfigurationHelper.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/util/TesterConfigurationHelper.java 2011-05-31 09:36:56 UTC (rev 4460)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/util/TesterConfigurationHelper.java 2011-05-31 09:54:35 UTC (rev 4461)
@@ -187,7 +187,7 @@
// Indexer
ArrayList qParams = new ArrayList();
- qParams.add(new SimpleParameterEntry("indexDir", "../temp/index/" + IdGenerator.generate()));
+ qParams.add(new SimpleParameterEntry("indexDir", "target/temp/index/" + IdGenerator.generate()));
QueryHandlerEntry qEntry =
new QueryHandlerEntry("org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex", qParams);
@@ -211,7 +211,7 @@
LockPersisterEntry persisterEntry = new LockPersisterEntry();
persisterEntry.setType("org.exoplatform.services.jcr.impl.core.lock.FileSystemLockPersister");
ArrayList lpParams = new ArrayList();
- lpParams.add(new SimpleParameterEntry("path", "../temp/lock"));
+ lpParams.add(new SimpleParameterEntry("path", "target/temp/lock"));
persisterEntry.setParameters(lpParams);
lockManagerEntry.setPersister(persisterEntry);
workspaceEntry.setLockManager(lockManagerEntry);
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/test/resources/log4j.properties
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/test/resources/log4j.properties 2011-05-31 09:36:56 UTC (rev 4460)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/test/resources/log4j.properties 2011-05-31 09:54:35 UTC (rev 4461)
@@ -17,8 +17,7 @@
# 'file' is set to be a FileAppender.
log4j.appender.file=org.apache.log4j.FileAppender
-#log4j.appender.file.File=jcr.log
-log4j.appender.file.File=nul
+log4j.appender.file.File=target/jcr.log
# 'file' uses PatternLayout.
log4j.appender.file.layout=org.apache.log4j.PatternLayout
Modified: jcr/branches/1.12.x/exo.jcr.component.webdav/pom.xml
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.webdav/pom.xml 2011-05-31 09:36:56 UTC (rev 4460)
+++ jcr/branches/1.12.x/exo.jcr.component.webdav/pom.xml 2011-05-31 09:54:35 UTC (rev 4461)
@@ -107,6 +107,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
+ <argLine>${env.MAVEN_OPTS} -Dcom.arjuna.ats.arjuna.objectstore.objectStoreDir=${project.build.directory}</argLine>
<excludes>
<exclude>**/TestUtils.java</exclude>
<exclude>**/OrderPatchTest.java</exclude>
12 years, 11 months
exo-jcr SVN: r4460 - kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/transaction/impl.
by do-not-reply@jboss.org
Author: dkuleshov
Date: 2011-05-31 05:36:56 -0400 (Tue, 31 May 2011)
New Revision: 4460
Modified:
kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/transaction/impl/AbstractTransactionService.java
Log:
EXOJCR-1365: reverted to remove privileged blocks
Modified: kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/transaction/impl/AbstractTransactionService.java
===================================================================
--- kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/transaction/impl/AbstractTransactionService.java 2011-05-31 09:36:35 UTC (rev 4459)
+++ kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/transaction/impl/AbstractTransactionService.java 2011-05-31 09:36:56 UTC (rev 4460)
@@ -24,7 +24,6 @@
import org.exoplatform.services.log.Log;
import org.exoplatform.services.transaction.TransactionService;
-import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import javax.transaction.HeuristicMixedException;
@@ -110,49 +109,14 @@
final Transaction tx = tm.getTransaction();
if (tx != null)
{
- PrivilegedExceptionAction<Boolean> action = new PrivilegedExceptionAction<Boolean>()
+ int flag = XAResource.TMSUCCESS;
+ switch (tx.getStatus())
{
- public Boolean run() throws Exception
- {
- int flag = XAResource.TMSUCCESS;
- switch (tx.getStatus())
- {
- case Status.STATUS_MARKED_ROLLBACK:
- case Status.STATUS_ROLLEDBACK:
- case Status.STATUS_ROLLING_BACK: flag = XAResource.TMFAIL;
- }
- return tx.delistResource(xares, flag);
- }
- };
- try
- {
- return SecurityHelper.doPrivilegedExceptionAction(action);
- }
- catch (PrivilegedActionException pae)
- {
- Throwable cause = pae.getCause();
-
- if (cause instanceof RollbackException)
- {
- throw (RollbackException)cause;
- }
- else if (cause instanceof IllegalStateException)
- {
- throw (IllegalStateException)cause;
- }
- else if (cause instanceof SystemException)
- {
- throw (SystemException)cause;
- }
- else if (cause instanceof RuntimeException)
- {
- throw (RuntimeException)cause;
- }
- else
- {
- throw new RuntimeException(cause);
- }
- }
+ case Status.STATUS_MARKED_ROLLBACK:
+ case Status.STATUS_ROLLEDBACK:
+ case Status.STATUS_ROLLING_BACK: flag = XAResource.TMFAIL;
+ }
+ return tx.delistResource(xares, flag);
}
else
{
@@ -169,42 +133,7 @@
final Transaction tx = tm.getTransaction();
if (tx != null)
{
- PrivilegedExceptionAction<Boolean> action = new PrivilegedExceptionAction<Boolean>()
- {
- public Boolean run() throws Exception
- {
- return tx.enlistResource(xares);
- }
- };
- try
- {
- return SecurityHelper.doPrivilegedExceptionAction(action);
- }
- catch (PrivilegedActionException pae)
- {
- Throwable cause = pae.getCause();
-
- if (cause instanceof RollbackException)
- {
- throw (RollbackException)cause;
- }
- else if (cause instanceof IllegalStateException)
- {
- throw (IllegalStateException)cause;
- }
- else if (cause instanceof SystemException)
- {
- throw (SystemException)cause;
- }
- else if (cause instanceof RuntimeException)
- {
- throw (RuntimeException)cause;
- }
- else
- {
- throw new RuntimeException(cause);
- }
- }
+ return tx.enlistResource(xares);
}
else
{
@@ -385,38 +314,7 @@
}
// Start the transaction
- PrivilegedExceptionAction<Object> action = new PrivilegedExceptionAction<Object>()
- {
- public Object run() throws Exception
- {
- tm.begin();
- return null;
- }
- };
- try
- {
- SecurityHelper.doPrivilegedExceptionAction(action);
- }
- catch (PrivilegedActionException pae)
- {
- Throwable cause = pae.getCause();
- if (cause instanceof NotSupportedException)
- {
- throw (NotSupportedException)cause;
- }
- else if (cause instanceof SystemException)
- {
- throw (SystemException)cause;
- }
- else if (cause instanceof RuntimeException)
- {
- throw (RuntimeException)cause;
- }
- else
- {
- throw new RuntimeException(cause);
- }
- }
+ tm.begin();
}
/**
@@ -425,54 +323,7 @@
public void commit() throws RollbackException, HeuristicMixedException, HeuristicRollbackException,
SecurityException, IllegalStateException, SystemException
{
- PrivilegedExceptionAction<Object> action = new PrivilegedExceptionAction<Object>()
- {
- public Object run() throws Exception
- {
- tm.commit();
- return null;
- }
- };
- try
- {
- SecurityHelper.doPrivilegedExceptionAction(action);
- }
- catch (PrivilegedActionException pae)
- {
- Throwable cause = pae.getCause();
- if (cause instanceof RollbackException)
- {
- throw (RollbackException)cause;
- }
- else if (cause instanceof HeuristicMixedException)
- {
- throw (HeuristicMixedException)cause;
- }
- else if (cause instanceof HeuristicRollbackException)
- {
- throw (HeuristicRollbackException)cause;
- }
- else if (cause instanceof SecurityException)
- {
- throw (SecurityException)cause;
- }
- else if (cause instanceof IllegalStateException)
- {
- throw (IllegalStateException)cause;
- }
- else if (cause instanceof SystemException)
- {
- throw (SystemException)cause;
- }
- else if (cause instanceof RuntimeException)
- {
- throw (RuntimeException)cause;
- }
- else
- {
- throw new RuntimeException(cause);
- }
- }
+ tm.commit();
}
/**
@@ -488,32 +339,7 @@
*/
public Transaction getTransaction() throws SystemException
{
- try
- {
- return SecurityHelper.doPrivilegedExceptionAction(new PrivilegedExceptionAction<Transaction>()
- {
- public Transaction run() throws Exception
- {
- return tm.getTransaction();
- }
- });
- }
- catch (PrivilegedActionException pae)
- {
- Throwable cause = pae.getCause();
- if (cause instanceof SystemException)
- {
- throw (SystemException)cause;
- }
- else if (cause instanceof RuntimeException)
- {
- throw (RuntimeException)cause;
- }
- else
- {
- throw new RuntimeException(cause);
- }
- }
+ return tm.getTransaction();
}
/**
@@ -522,42 +348,7 @@
public void resume(final Transaction tx) throws InvalidTransactionException, IllegalStateException,
SystemException
{
- PrivilegedExceptionAction<Object> action = new PrivilegedExceptionAction<Object>()
- {
- public Object run() throws Exception
- {
- tm.resume(tx);
- return null;
- }
- };
- try
- {
- SecurityHelper.doPrivilegedExceptionAction(action);
- }
- catch (PrivilegedActionException pae)
- {
- Throwable cause = pae.getCause();
- if (cause instanceof InvalidTransactionException)
- {
- throw (InvalidTransactionException)cause;
- }
- else if (cause instanceof IllegalStateException)
- {
- throw (IllegalStateException)cause;
- }
- else if (cause instanceof SystemException)
- {
- throw (SystemException)cause;
- }
- else if (cause instanceof RuntimeException)
- {
- throw (RuntimeException)cause;
- }
- else
- {
- throw new RuntimeException(cause);
- }
- }
+ tm.resume(tx);
}
/**
@@ -565,42 +356,7 @@
*/
public void rollback() throws IllegalStateException, SecurityException, SystemException
{
- PrivilegedExceptionAction<Object> action = new PrivilegedExceptionAction<Object>()
- {
- public Object run() throws Exception
- {
- tm.rollback();
- return null;
- }
- };
- try
- {
- SecurityHelper.doPrivilegedExceptionAction(action);
- }
- catch (PrivilegedActionException pae)
- {
- Throwable cause = pae.getCause();
- if (cause instanceof IllegalStateException)
- {
- throw (IllegalStateException)cause;
- }
- else if (cause instanceof SecurityException)
- {
- throw (SecurityException)cause;
- }
- else if (cause instanceof SystemException)
- {
- throw (SystemException)cause;
- }
- else if (cause instanceof RuntimeException)
- {
- throw (RuntimeException)cause;
- }
- else
- {
- throw new RuntimeException(cause);
- }
- }
+ tm.rollback();
}
/**
@@ -625,33 +381,7 @@
*/
public Transaction suspend() throws SystemException
{
- PrivilegedExceptionAction<Transaction> action = new PrivilegedExceptionAction<Transaction>()
- {
- public Transaction run() throws Exception
- {
- return tm.suspend();
- }
- };
- try
- {
- return SecurityHelper.doPrivilegedExceptionAction(action);
- }
- catch (PrivilegedActionException pae)
- {
- Throwable cause = pae.getCause();
- if (cause instanceof SystemException)
- {
- throw (SystemException)cause;
- }
- else if (cause instanceof RuntimeException)
- {
- throw (RuntimeException)cause;
- }
- else
- {
- throw new RuntimeException(cause);
- }
- }
+ return tm.suspend();
}
}
@@ -684,38 +414,7 @@
*/
public void begin() throws NotSupportedException, SystemException
{
- PrivilegedExceptionAction<Object> action = new PrivilegedExceptionAction<Object>()
- {
- public Object run() throws Exception
- {
- tm.begin();
- return null;
- }
- };
- try
- {
- SecurityHelper.doPrivilegedExceptionAction(action);
- }
- catch (PrivilegedActionException pae)
- {
- Throwable cause = pae.getCause();
- if (cause instanceof NotSupportedException)
- {
- throw (NotSupportedException)cause;
- }
- else if (cause instanceof SystemException)
- {
- throw (SystemException)cause;
- }
- else if (cause instanceof RuntimeException)
- {
- throw (RuntimeException)cause;
- }
- else
- {
- throw new RuntimeException(cause);
- }
- }
+ tm.begin();
}
/**
@@ -724,54 +423,7 @@
public void commit() throws RollbackException, HeuristicMixedException, HeuristicRollbackException,
SecurityException, IllegalStateException, SystemException
{
- PrivilegedExceptionAction<Object> action = new PrivilegedExceptionAction<Object>()
- {
- public Object run() throws Exception
- {
- tm.commit();
- return null;
- }
- };
- try
- {
- SecurityHelper.doPrivilegedExceptionAction(action);
- }
- catch (PrivilegedActionException pae)
- {
- Throwable cause = pae.getCause();
- if (cause instanceof RollbackException)
- {
- throw (RollbackException)cause;
- }
- else if (cause instanceof HeuristicMixedException)
- {
- throw (HeuristicMixedException)cause;
- }
- else if (cause instanceof HeuristicRollbackException)
- {
- throw (HeuristicRollbackException)cause;
- }
- else if (cause instanceof SecurityException)
- {
- throw (SecurityException)cause;
- }
- else if (cause instanceof IllegalStateException)
- {
- throw (IllegalStateException)cause;
- }
- else if (cause instanceof SystemException)
- {
- throw (SystemException)cause;
- }
- else if (cause instanceof RuntimeException)
- {
- throw (RuntimeException)cause;
- }
- else
- {
- throw new RuntimeException(cause);
- }
- }
+ tm.commit();
}
/**
@@ -779,42 +431,7 @@
*/
public void rollback() throws IllegalStateException, SecurityException, SystemException
{
- PrivilegedExceptionAction<Object> action = new PrivilegedExceptionAction<Object>()
- {
- public Object run() throws Exception
- {
- tm.rollback();
- return null;
- }
- };
- try
- {
- SecurityHelper.doPrivilegedExceptionAction(action);
- }
- catch (PrivilegedActionException pae)
- {
- Throwable cause = pae.getCause();
- if (cause instanceof IllegalStateException)
- {
- throw (IllegalStateException)cause;
- }
- else if (cause instanceof SecurityException)
- {
- throw (SecurityException)cause;
- }
- else if (cause instanceof SystemException)
- {
- throw (SystemException)cause;
- }
- else if (cause instanceof RuntimeException)
- {
- throw (RuntimeException)cause;
- }
- else
- {
- throw new RuntimeException(cause);
- }
- }
+ tm.rollback();
}
/**
12 years, 11 months
exo-jcr SVN: r4459 - jcr/trunk/exo.jcr.component.core/src/test/resources.
by do-not-reply@jboss.org
Author: dkuleshov
Date: 2011-05-31 05:36:35 -0400 (Tue, 31 May 2011)
New Revision: 4459
Added:
jcr/trunk/exo.jcr.component.core/src/test/resources/tsm-excludes.properties
Log:
EXOJCR-1365: added exludes for SecurityHelper for testing
Added: jcr/trunk/exo.jcr.component.core/src/test/resources/tsm-excludes.properties
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/resources/tsm-excludes.properties (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/tsm-excludes.properties 2011-05-31 09:36:35 UTC (rev 4459)
@@ -0,0 +1,8 @@
+org.exoplatform.services.jcr.api.xa.TestXATransaction.testSimpleGlobalTransaction=begin,commit
+org.exoplatform.services.jcr.api.xa.TestXATransaction.test2GlobalTransactions=begin,commit,suspend,resume
+org.exoplatform.services.jcr.api.xa.TestXATransaction.test2GlobalTransactions2=begin,commit,suspend,resume,rollback
+org.exoplatform.services.jcr.api.xa.TestXATransaction.testLockInTransactions=begin,commit
+org.exoplatform.services.jcr.api.xa.TestXATransaction.testSimpleGlobalTransaction=begin,commit
+org.exoplatform.services.jcr.api.xa.TestXATransaction.test2GlobalTransactions=begin,commit,suspend,resume
+org.exoplatform.services.jcr.api.xa.TestXATransaction.test2GlobalTransactions2=begin,commit,suspend,resume,rollback
+org.exoplatform.services.jcr.api.xa.TestXATransaction.testLockInTransactions=begin,commit
\ No newline at end of file
12 years, 11 months
exo-jcr SVN: r4458 - core/branches/2.3.x/patch/2.3.8/COR-228.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-05-31 05:14:21 -0400 (Tue, 31 May 2011)
New Revision: 4458
Modified:
core/branches/2.3.x/patch/2.3.8/COR-228/COR-228.patch
Log:
COR-228: patch updated
Modified: core/branches/2.3.x/patch/2.3.8/COR-228/COR-228.patch
===================================================================
--- core/branches/2.3.x/patch/2.3.8/COR-228/COR-228.patch 2011-05-31 08:15:27 UTC (rev 4457)
+++ core/branches/2.3.x/patch/2.3.8/COR-228/COR-228.patch 2011-05-31 09:14:21 UTC (rev 4458)
@@ -5267,3 +5267,15 @@
}
-
}
+Index: packaging/module/src/main/javascript/core.packaging.module.js
+===================================================================
+--- packaging/module/src/main/javascript/core.packaging.module.js (revision 4450)
++++ packaging/module/src/main/javascript/core.packaging.module.js (working copy)
+@@ -39,6 +39,7 @@
+ module.component.documents =
+ new Project("org.exoplatform.core", "exo.core.component.document", "jar", module.version).
+ addDependency(new Project("org.apache.pdfbox", "pdfbox", "jar", "1.1.0")).
++ addDependency(new Project("org.apache.pdfbox", "jempbox", "jar", "1.1.0")).
+ addDependency(new Project("com.lowagie", "itext", "jar", "2.1.0")).
+ addDependency(new Project("bouncycastle", "bcmail-jdk14", "jar", "136")).
+ addDependency(new Project("bouncycastle", "bcprov-jdk14", "jar", "136")).
12 years, 11 months
exo-jcr SVN: r4457 - kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-05-31 04:15:27 -0400 (Tue, 31 May 2011)
New Revision: 4457
Added:
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestScopingObjectName.java
Modified:
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestPortalContainer.java
Log:
EXOJCR-1365: Move test to separate class
Modified: kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestPortalContainer.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestPortalContainer.java 2011-05-31 07:18:51 UTC (rev 4456)
+++ kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestPortalContainer.java 2011-05-31 08:15:27 UTC (rev 4457)
@@ -32,18 +32,6 @@
public class TestPortalContainer extends AbstractTestContainer
{
- public void testHasScopingObjectName()
- {
- URL rootURL = getClass().getResource("empty-config.xml");
- URL portalURL = getClass().getResource("empty-config.xml");
- assertNotNull(rootURL);
- assertNotNull(portalURL);
- //
- new ContainerBuilder().withRoot(rootURL).withPortal(portalURL).build();
- assertNull(RootContainer.getInstance().getScopingObjectName());
- assertNotNull(PortalContainer.getInstance().getScopingObjectName());
- }
-
public void testInitValues()
{
createRootContainer("portal-container-config-with-settings.xml");
Added: kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestScopingObjectName.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestScopingObjectName.java (rev 0)
+++ kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestScopingObjectName.java 2011-05-31 08:15:27 UTC (rev 4457)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2009 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
+ */
+package org.exoplatform.container;
+
+import org.exoplatform.container.jmx.AbstractTestContainer;
+import org.exoplatform.container.support.ContainerBuilder;
+
+import java.net.URL;
+
+/**
+ * @author <a href="anatoliy.bazko(a)exoplatform.com">Anatoliy Bazko</a>
+ * @version $Id: TestScopingObjectName.java 34360 2009-07-22 23:58:59Z tolusha $
+ */
+public class TestScopingObjectName extends AbstractTestContainer
+{
+ public void testHasScopingObjectName()
+ {
+ URL rootURL = getClass().getResource("empty-config.xml");
+ URL portalURL = getClass().getResource("empty-config.xml");
+ assertNotNull(rootURL);
+ assertNotNull(portalURL);
+ //
+ new ContainerBuilder().withRoot(rootURL).withPortal(portalURL).build();
+ assertNull(RootContainer.getInstance().getScopingObjectName());
+ assertNotNull(PortalContainer.getInstance().getScopingObjectName());
+ }
+
+}
12 years, 11 months
exo-jcr SVN: r4456 - in jcr/branches/1.12.x/patch/1.12.9-GA: JCR-1631 and 1 other directory.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2011-05-31 03:18:51 -0400 (Tue, 31 May 2011)
New Revision: 4456
Added:
jcr/branches/1.12.x/patch/1.12.9-GA/JCR-1631/
jcr/branches/1.12.x/patch/1.12.9-GA/JCR-1631/JCR-1631.patch
Log:
JCR-1631: patch proposed
Added: jcr/branches/1.12.x/patch/1.12.9-GA/JCR-1631/JCR-1631.patch
===================================================================
--- jcr/branches/1.12.x/patch/1.12.9-GA/JCR-1631/JCR-1631.patch (rev 0)
+++ jcr/branches/1.12.x/patch/1.12.9-GA/JCR-1631/JCR-1631.patch 2011-05-31 07:18:51 UTC (rev 4456)
@@ -0,0 +1,16 @@
+Index: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/XASessionImpl.java
+===================================================================
+--- exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/XASessionImpl.java (revision 4455)
++++ exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/XASessionImpl.java (working copy)
+@@ -208,9 +208,9 @@
+ catch (TransactionException e)
+ {
+ commitException = e;
+- if (LOG.isDebugEnabled())
++ if (LOG.isErrorEnabled())
+ {
+- LOG.debug("Commit Error. Xid:" + xid + ", session: " + getSessionInfo() + ", " + this, e);
++ LOG.error("Commit Error. Xid:" + xid + ", session: " + getSessionInfo() + ", " + this, e);
+ }
+
+ throw new XASessionException(e.toString(), e.getErrorCode());
12 years, 11 months