exo-jcr SVN: r1475 - core/trunk.
by do-not-reply@jboss.org
Author: dkatayev
Date: 2010-01-19 06:34:34 -0500 (Tue, 19 Jan 2010)
New Revision: 1475
Modified:
core/trunk/pom.xml
Log:
EXOJCR-388 main updates according to the dependencies list of EAP applied
Modified: core/trunk/pom.xml
===================================================================
--- core/trunk/pom.xml 2010-01-19 11:34:11 UTC (rev 1474)
+++ core/trunk/pom.xml 2010-01-19 11:34:34 UTC (rev 1475)
@@ -152,7 +152,7 @@
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
- <version>2.3</version>
+ <version>2.4</version>
</dependency>
<dependency>
16 years, 3 months
exo-jcr SVN: r1474 - kernel/trunk.
by do-not-reply@jboss.org
Author: dkatayev
Date: 2010-01-19 06:34:11 -0500 (Tue, 19 Jan 2010)
New Revision: 1474
Modified:
kernel/trunk/pom.xml
Log:
EXOJCR-388 main updates according to the dependencies list of EAP applied
Modified: kernel/trunk/pom.xml
===================================================================
--- kernel/trunk/pom.xml 2010-01-19 11:33:49 UTC (rev 1473)
+++ kernel/trunk/pom.xml 2010-01-19 11:34:11 UTC (rev 1474)
@@ -134,7 +134,7 @@
<dependency>
<groupId>quartz</groupId>
<artifactId>quartz</artifactId>
- <version>1.5.0-RC2</version>
+ <version>1.5.2</version>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
@@ -170,7 +170,7 @@
<dependency>
<groupId>jgroups</groupId>
<artifactId>jgroups</artifactId>
- <version>2.6.12.GA</version>
+ <version>2.6.13.GA</version>
</dependency>
<dependency>
<groupId>org.jboss.cache</groupId>
16 years, 3 months
exo-jcr SVN: r1473 - junit.framework/trunk.
by do-not-reply@jboss.org
Author: dkatayev
Date: 2010-01-19 06:33:49 -0500 (Tue, 19 Jan 2010)
New Revision: 1473
Modified:
junit.framework/trunk/pom.xml
Log:
EXOJCR-388 parent pom version updated to 3 tag; main updates according to the dependencies list of EAP applied
Modified: junit.framework/trunk/pom.xml
===================================================================
--- junit.framework/trunk/pom.xml 2010-01-19 11:06:17 UTC (rev 1472)
+++ junit.framework/trunk/pom.xml 2010-01-19 11:33:49 UTC (rev 1473)
@@ -24,7 +24,7 @@
<parent>
<groupId>org.exoplatform</groupId>
<artifactId>foundation-parent</artifactId>
- <version>3-SNAPSHOT</version>
+ <version>3</version>
</parent>
<groupId>org.exoplatform.tool</groupId>
@@ -54,7 +54,7 @@
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
- <version>2.1</version>
+ <version>2.2</version>
<scope>test</scope>
</dependency>
16 years, 3 months
exo-jcr SVN: r1472 - jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache.
by do-not-reply@jboss.org
Author: skabashnyuk
Date: 2010-01-19 06:06:17 -0500 (Tue, 19 Jan 2010)
New Revision: 1472
Modified:
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java
Log:
EXOJCR-390 : code style
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java 2010-01-19 09:33:12 UTC (rev 1471)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java 2010-01-19 11:06:17 UTC (rev 1472)
@@ -356,7 +356,9 @@
try
{
if (!inTransaction)
+ {
cache.beginTransaction();
+ }
cache.setLocal(true);
if (item.isNode())
{
@@ -371,7 +373,9 @@
{
cache.setLocal(false);
if (!inTransaction)
+ {
cache.commitTransaction();
+ }
}
}
@@ -438,7 +442,10 @@
{
if (!inTransaction)
+ {
cache.beginTransaction();
+ }
+
cache.setLocal(true);
// remove previous all (to be sure about consistency)
cache.removeNode(makeChildListFqn(childNodesList, parent.getIdentifier()));
@@ -463,7 +470,9 @@
{
cache.setLocal(false);
if (!inTransaction)
+ {
cache.commitTransaction();
+ }
}
}
@@ -476,7 +485,9 @@
try
{
if (!inTransaction)
+ {
cache.beginTransaction();
+ }
cache.setLocal(true);
// remove previous all (to be sure about consistency)
cache.removeNode(makeChildListFqn(childPropsList, parent.getIdentifier()));
@@ -501,7 +512,9 @@
{
cache.setLocal(false);
if (!inTransaction)
+ {
cache.commitTransaction();
+ }
}
}
16 years, 3 months
exo-jcr SVN: r1471 - jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2010-01-19 04:33:12 -0500 (Tue, 19 Jan 2010)
New Revision: 1471
Modified:
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManager.java
Log:
EXOJCR-412 : The skiping exception on delete locks properties (jcr:lockIsDeep, jcr:lockOwner) on save was added.
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManager.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManager.java 2010-01-18 23:01:45 UTC (rev 1470)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManager.java 2010-01-19 09:33:12 UTC (rev 1471)
@@ -46,6 +46,7 @@
import org.exoplatform.services.jcr.impl.dataflow.TransientItemData;
import org.exoplatform.services.jcr.impl.dataflow.TransientPropertyData;
import org.exoplatform.services.jcr.impl.dataflow.persistent.WorkspacePersistentDataManager;
+import org.exoplatform.services.jcr.impl.storage.JCRInvalidItemStateException;
import org.exoplatform.services.jcr.observation.ExtendedEvent;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -715,6 +716,16 @@
dataManager.save(new TransactionChangesLog(changesLog));
}
+ catch (JCRInvalidItemStateException e)
+ {
+ //TODO EXOJCR-412, should be refactored in future.
+ //Skip property not found in DB, because that lock property was removed in other node of cluster.
+ if (log.isDebugEnabled())
+ {
+ log.debug("The propperty was removed in other node of cluster.", e);
+ }
+
+ }
catch (RepositoryException e)
{
log.error("Error occur during removing lock" + e.getLocalizedMessage(), e);
16 years, 3 months
exo-jcr SVN: r1470 - in core/trunk: exo.core.component.organization.api/src/main/java/org/exoplatform/services/organization/cache and 4 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-01-18 18:01:45 -0500 (Mon, 18 Jan 2010)
New Revision: 1470
Added:
core/trunk/exo.core.component.organization.api/src/main/java/org/exoplatform/services/organization/impl/mock/LazyListImpl.java
Modified:
core/trunk/exo.core.component.organization.api/src/main/java/org/exoplatform/services/organization/Query.java
core/trunk/exo.core.component.organization.api/src/main/java/org/exoplatform/services/organization/UserHandler.java
core/trunk/exo.core.component.organization.api/src/main/java/org/exoplatform/services/organization/cache/CacheableUserHandlerImpl.java
core/trunk/exo.core.component.organization.api/src/main/java/org/exoplatform/services/organization/impl/mock/DummyOrganizationService.java
core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserDAOImpl.java
core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/jdbc/UserDAOImpl.java
core/trunk/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/UserDAOImpl.java
Log:
EXOJCR-415 : UserHandler provide ListAccess for retrieving list of users
EXOJCR-416 : Organization service Query object implements Serializable
Modified: core/trunk/exo.core.component.organization.api/src/main/java/org/exoplatform/services/organization/Query.java
===================================================================
--- core/trunk/exo.core.component.organization.api/src/main/java/org/exoplatform/services/organization/Query.java 2010-01-18 16:23:05 UTC (rev 1469)
+++ core/trunk/exo.core.component.organization.api/src/main/java/org/exoplatform/services/organization/Query.java 2010-01-18 23:01:45 UTC (rev 1470)
@@ -18,13 +18,14 @@
*/
package org.exoplatform.services.organization;
+import java.io.Serializable;
import java.util.Date;
/**
* Created by The eXo Platform SAS . Author : Tuan Nguyen
* tuan08(a)users.sourceforge.net Date: Jun 14, 2003 Time: 1:12:22 PM
*/
-public class Query
+public class Query implements Serializable
{
private String userName_;
Modified: core/trunk/exo.core.component.organization.api/src/main/java/org/exoplatform/services/organization/UserHandler.java
===================================================================
--- core/trunk/exo.core.component.organization.api/src/main/java/org/exoplatform/services/organization/UserHandler.java 2010-01-18 16:23:05 UTC (rev 1469)
+++ core/trunk/exo.core.component.organization.api/src/main/java/org/exoplatform/services/organization/UserHandler.java 2010-01-18 23:01:45 UTC (rev 1470)
@@ -18,6 +18,7 @@
*/
package org.exoplatform.services.organization;
+import org.exoplatform.commons.utils.ListAccess;
import org.exoplatform.commons.utils.PageList;
/**
@@ -125,10 +126,23 @@
* group
* @return return a page list iterator of a group of the user in the database
* @throws Exception
+ * @deprecated use {@link #findUsersByGroupId(String)} instead
*/
- public PageList findUsersByGroup(String groupId) throws Exception;
+ @Deprecated
+ public PageList<User> findUsersByGroup(String groupId) throws Exception;
/**
+ * This method should search and return the list of the users in a given
+ * group.
+ *
+ * @param groupId id of the group. The return users list should be in this
+ * group
+ * @return return a page list iterator of a group of the user in the database
+ * @throws Exception any exception
+ */
+ public ListAccess<User> findUsersByGroupId(String groupId) throws Exception;
+
+ /**
* This method is used to get all the users in the database
*
* @param pageSize The number of user in each page
@@ -136,19 +150,42 @@
* developer get all the users or get a page of users if the return
* number of users is too large.
* @throws Exception
+ * @deprecated use {@link @findAllUsers() } instead
*/
- public PageList getUserPageList(int pageSize) throws Exception;
+ @Deprecated
+ public PageList<User> getUserPageList(int pageSize) throws Exception;
/**
+ * This method is used to get all the users in the database
+ *
+ * @return return a page list iterator. The page list should allow the
+ * developer get all the users or get a page of users if the return
+ * number of users is too large.
+ * @throws Exception any exception
+ */
+ public ListAccess<User> findAllUsers() throws Exception;
+
+ /**
* This method search for the users accordding to a search criteria, the query
*
* @param query The query object contains the search criteria.
* @return return the found users in a page list according to the query.
* @throws Exception throw exception if the service cannot access the database
+ * @deprecated use {@link #findUsersByQuery(Query)} instead
*/
- public PageList findUsers(Query query) throws Exception;
+ @Deprecated
+ public PageList<User> findUsers(Query query) throws Exception;
/**
+ * This method search for the users accordding to a search criteria, the query
+ *
+ * @param query The query object contains the search criteria.
+ * @return return the found users in a page list according to the query.
+ * @throws Exception throw exception if the service cannot access the database
+ */
+ public ListAccess<User> findUsersByQuery(Query query) throws Exception;
+
+ /**
* Check if the username and the password of an user is valid.
*
* @param username
Modified: core/trunk/exo.core.component.organization.api/src/main/java/org/exoplatform/services/organization/cache/CacheableUserHandlerImpl.java
===================================================================
--- core/trunk/exo.core.component.organization.api/src/main/java/org/exoplatform/services/organization/cache/CacheableUserHandlerImpl.java 2010-01-18 16:23:05 UTC (rev 1469)
+++ core/trunk/exo.core.component.organization.api/src/main/java/org/exoplatform/services/organization/cache/CacheableUserHandlerImpl.java 2010-01-18 23:01:45 UTC (rev 1470)
@@ -16,6 +16,7 @@
*/
package org.exoplatform.services.organization.cache;
+import org.exoplatform.commons.utils.ListAccess;
import org.exoplatform.commons.utils.PageList;
import org.exoplatform.services.cache.ExoCache;
import org.exoplatform.services.organization.Membership;
@@ -123,7 +124,7 @@
/**
* {@inheritDoc}
*/
- public PageList findUsers(Query query) throws Exception
+ public PageList<User> findUsers(Query query) throws Exception
{
return userHandler.findUsers(query);
}
@@ -131,7 +132,7 @@
/**
* {@inheritDoc}
*/
- public PageList findUsersByGroup(String groupId) throws Exception
+ public PageList<User> findUsersByGroup(String groupId) throws Exception
{
return userHandler.findUsersByGroup(groupId);
}
@@ -139,7 +140,7 @@
/**
* {@inheritDoc}
*/
- public PageList getUserPageList(int pageSize) throws Exception
+ public PageList<User> getUserPageList(int pageSize) throws Exception
{
return userHandler.getUserPageList(pageSize);
}
@@ -147,6 +148,27 @@
/**
* {@inheritDoc}
*/
+ public ListAccess<User> findUsersByGroupId(String groupId) throws Exception {
+ return userHandler.findUsersByGroupId(groupId);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ListAccess<User> findAllUsers() throws Exception {
+ return userHandler.findAllUsers();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ListAccess<User> findUsersByQuery(Query query) throws Exception {
+ return userHandler.findUsersByQuery(query);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public User removeUser(String userName, boolean broadcast) throws Exception
{
User user = userHandler.removeUser(userName, broadcast);
Modified: core/trunk/exo.core.component.organization.api/src/main/java/org/exoplatform/services/organization/impl/mock/DummyOrganizationService.java
===================================================================
--- core/trunk/exo.core.component.organization.api/src/main/java/org/exoplatform/services/organization/impl/mock/DummyOrganizationService.java 2010-01-18 16:23:05 UTC (rev 1469)
+++ core/trunk/exo.core.component.organization.api/src/main/java/org/exoplatform/services/organization/impl/mock/DummyOrganizationService.java 2010-01-18 23:01:45 UTC (rev 1470)
@@ -21,6 +21,8 @@
*/
package org.exoplatform.services.organization.impl.mock;
+import org.exoplatform.commons.utils.LazyPageList;
+import org.exoplatform.commons.utils.ListAccess;
import org.exoplatform.commons.utils.ObjectPageList;
import org.exoplatform.commons.utils.PageList;
import org.exoplatform.services.organization.BaseOrganizationService;
@@ -152,12 +154,12 @@
private static final int DEFAULT_LIST_SIZE = 6;
- private List<User> users;
+ private LazyListImpl users;
public UserHandlerImpl()
{
- users = new ArrayList<User>();
+ users = new LazyListImpl();
User usr = new UserImpl("exo");
usr.setPassword("exo");
@@ -248,9 +250,23 @@
return null;
}
- public PageList findUsersByGroup(String groupId) throws Exception
+ public PageList<User> findUsersByGroup(String groupId) throws Exception
{
- List<User> users = new ArrayList<User>();
+ return new LazyPageList<User>(findUsersByGroupId(groupId), 10);
+ }
+
+ public PageList<User> findUsers(Query query) throws Exception
+ {
+ return new LazyPageList<User>(users, 10);
+ }
+
+ public ListAccess<User> findUsersByQuery(Query query) throws Exception
+ {
+ return users;
+ }
+
+ public ListAccess<User> findUsersByGroupId(String groupId) throws Exception {
+ LazyListImpl users = new LazyListImpl();
if (groupId.equals(GROUPID_USERS))
{
users.add(new UserImpl("exo"));
@@ -265,17 +281,17 @@
users.add(new UserImpl("john"));
users.add(new UserImpl("admin"));
}
- return new ObjectPageList(users, 10);
+ return users;
}
- public PageList getUserPageList(int pageSize) throws Exception
+ public ListAccess<User> findAllUsers() throws Exception
{
- return null;
+ return users;
}
- public PageList findUsers(Query query) throws Exception
+ public PageList<User> getUserPageList(int pageSize) throws Exception
{
- return new ObjectPageList(users, 10);
+ return new LazyPageList<User>(users, 10);
}
public void addUserEventListener(UserEventListener listener)
Added: core/trunk/exo.core.component.organization.api/src/main/java/org/exoplatform/services/organization/impl/mock/LazyListImpl.java
===================================================================
--- core/trunk/exo.core.component.organization.api/src/main/java/org/exoplatform/services/organization/impl/mock/LazyListImpl.java (rev 0)
+++ core/trunk/exo.core.component.organization.api/src/main/java/org/exoplatform/services/organization/impl/mock/LazyListImpl.java 2010-01-18 23:01:45 UTC (rev 1470)
@@ -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
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.services.organization.impl.mock;
+
+import org.exoplatform.commons.utils.ListAccess;
+import org.exoplatform.services.organization.User;
+
+import java.util.ArrayList;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class LazyListImpl extends ArrayList<User> implements ListAccess<User>
+{
+
+ public User[] load(int index, int length) throws Exception, IllegalArgumentException {
+ User[] users = new User[length];
+ toArray(users);
+ return users;
+ }
+
+ public int getSize() throws Exception {
+ return size();
+ }
+}
Modified: core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserDAOImpl.java
===================================================================
--- core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserDAOImpl.java 2010-01-18 16:23:05 UTC (rev 1469)
+++ core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserDAOImpl.java 2010-01-18 23:01:45 UTC (rev 1470)
@@ -19,14 +19,12 @@
package org.exoplatform.services.organization.hibernate;
import org.exoplatform.commons.utils.LazyPageList;
+import org.exoplatform.commons.utils.ListAccess;
import org.exoplatform.services.cache.CacheService;
import org.exoplatform.services.cache.ExoCache;
import org.exoplatform.services.database.HibernateService;
import org.exoplatform.services.database.ObjectQuery;
-import org.exoplatform.services.organization.Query;
-import org.exoplatform.services.organization.User;
-import org.exoplatform.services.organization.UserEventListener;
-import org.exoplatform.services.organization.UserHandler;
+import org.exoplatform.services.organization.*;
import org.exoplatform.services.organization.impl.UserImpl;
import org.hibernate.Session;
import org.hibernate.Transaction;
@@ -144,12 +142,17 @@
return user;
}
- public LazyPageList getUserPageList(int pageSize) throws Exception
+ public LazyPageList<User> getUserPageList(int pageSize) throws Exception
{
+ return new LazyPageList<User>(findAllUsers(), 20);
+ }
+
+ public ListAccess<User> findAllUsers() throws Exception
+ {
String findQuery = "from o in class " + UserImpl.class.getName();
String countQuery = "select count(o) from " + UserImpl.class.getName() + " o";
- return new LazyPageList(new SimpleHibernateUserListAccess(service_, findQuery, countQuery), 20);
+ return new SimpleHibernateUserListAccess(service_, findQuery, countQuery);
}
public boolean authenticate(String username, String password) throws Exception
@@ -167,8 +170,13 @@
return authenticated;
}
- public LazyPageList findUsers(Query q) throws Exception
+ public LazyPageList<User> findUsers(Query q) throws Exception
{
+ return new LazyPageList<User>(findUsersByQuery(q), 20);
+ }
+
+ public ListAccess<User> findUsersByQuery(Query q) throws Exception
+ {
ObjectQuery oq = new ObjectQuery(UserImpl.class);
oq.addLIKE("userName", q.getUserName());
oq.addLIKE("firstName", q.getFirstName());
@@ -177,12 +185,16 @@
oq.addGT("lastLoginTime", q.getFromLoginDate());
oq.addLT("lastLoginTime", q.getToLoginDate());
- return new LazyPageList(new SimpleHibernateUserListAccess(service_, oq.getHibernateQuery(), oq
- .getHibernateCountQuery()), 20);
+ return new SimpleHibernateUserListAccess(service_, oq.getHibernateQuery(), oq.getHibernateCountQuery());
}
- public LazyPageList findUsersByGroup(String groupId) throws Exception
+ public LazyPageList<User> findUsersByGroup(String groupId) throws Exception
{
+ return new LazyPageList<User>(findUsersByGroupId(groupId), 20);
+ }
+
+ public ListAccess<User> findUsersByGroupId(String groupId) throws Exception
+ {
String queryFindUsersInGroup =
"select u " + "from u in class org.exoplatform.services.organization.impl.UserImpl, "
+ " m in class org.exoplatform.services.organization.impl.MembershipImpl "
@@ -192,7 +204,7 @@
+ " m in class org.exoplatform.services.organization.impl.MembershipImpl "
+ "where m.userName = u.userName " + " and m.groupId = '" + groupId + "'";
- return new LazyPageList(new SimpleHibernateUserListAccess(service_, queryFindUsersInGroup, countUsersInGroup), 20);
+ return new SimpleHibernateUserListAccess(service_, queryFindUsersInGroup, countUsersInGroup);
}
public Collection findUsersByGroupAndRole(String groupName, String role) throws Exception
Modified: core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/jdbc/UserDAOImpl.java
===================================================================
--- core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/jdbc/UserDAOImpl.java 2010-01-18 16:23:05 UTC (rev 1469)
+++ core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/jdbc/UserDAOImpl.java 2010-01-18 23:01:45 UTC (rev 1470)
@@ -19,7 +19,7 @@
package org.exoplatform.services.organization.jdbc;
import org.exoplatform.commons.utils.LazyPageList;
-import org.exoplatform.commons.utils.PageList;
+import org.exoplatform.commons.utils.ListAccess;
import org.exoplatform.container.PortalContainer;
import org.exoplatform.services.database.DBObjectMapper;
import org.exoplatform.services.database.DBObjectQuery;
@@ -28,14 +28,7 @@
import org.exoplatform.services.listener.ListenerService;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
-import org.exoplatform.services.organization.Group;
-import org.exoplatform.services.organization.GroupHandler;
-import org.exoplatform.services.organization.Membership;
-import org.exoplatform.services.organization.MembershipHandler;
-import org.exoplatform.services.organization.OrganizationService;
-import org.exoplatform.services.organization.User;
-import org.exoplatform.services.organization.UserEventListener;
-import org.exoplatform.services.organization.UserHandler;
+import org.exoplatform.services.organization.*;
import java.util.Calendar;
import java.util.List;
@@ -106,10 +99,15 @@
return user;
}
+ public LazyPageList<User> findUsers(org.exoplatform.services.organization.Query orgQuery) throws Exception
+ {
+ return new LazyPageList<User>(findUsersByQuery(orgQuery), 20);
+ }
+
/**
* Query( name = "" , standardSQL = "..." oracleSQL = "..." )
*/
- public LazyPageList findUsers(org.exoplatform.services.organization.Query orgQuery) throws Exception
+ public ListAccess<User> findUsersByQuery(Query orgQuery) throws Exception
{
DBObjectQuery dbQuery = new DBObjectQuery<UserImpl>(UserImpl.class);
dbQuery.addLIKE("USER_NAME", orgQuery.getUserName());
@@ -119,12 +117,16 @@
dbQuery.addGT("LAST_LOGIN_TIME", orgQuery.getFromLoginDate());
dbQuery.addLT("LAST_LOGIN_TIME", orgQuery.getToLoginDate());
- return new LazyPageList(new SimpleJDBCUserListAccess(this, dbQuery.toQuery(), dbQuery.toCountQuery()), 20);
+ return new SimpleJDBCUserListAccess(this, dbQuery.toQuery(), dbQuery.toCountQuery());
}
- @SuppressWarnings("unchecked")
- public PageList findUsersByGroup(String groupId) throws Exception
+ public LazyPageList<User> findUsersByGroup(String groupId) throws Exception
{
+ return new LazyPageList<User>(findUsersByGroupId(groupId), 20);
+ }
+
+ public ListAccess<User> findUsersByGroupId(String groupId) throws Exception
+ {
if (log.isDebugEnabled())
log.debug("+++++++++++FIND USER BY GROUP_ID " + groupId);
PortalContainer manager = PortalContainer.getInstance();
@@ -132,6 +134,7 @@
MembershipHandler membershipHandler = service.getMembershipHandler();
GroupHandler groupHandler = service.getGroupHandler();
Group group = groupHandler.findGroupById(groupId);
+ @SuppressWarnings("unchecked")
List<Membership> members = (List<Membership>)membershipHandler.findMembershipsByGroup(group);
DBObjectQuery dbQuery = new DBObjectQuery<UserImpl>(UserImpl.class);
@@ -145,15 +148,18 @@
*/
}
- return new LazyPageList(new SimpleJDBCUserListAccess(this, dbQuery.toQueryUseOR(), dbQuery.toCountQueryUseOR()),
- 20);
+ return new SimpleJDBCUserListAccess(this, dbQuery.toQueryUseOR(), dbQuery.toCountQueryUseOR());
}
- public LazyPageList getUserPageList(int pageSize) throws Exception
+ public LazyPageList<User> getUserPageList(int pageSize) throws Exception
{
+ return new LazyPageList<User>(findAllUsers(), pageSize);
+ }
+
+ public ListAccess<User> findAllUsers() throws Exception
+ {
DBObjectQuery dbQuery = new DBObjectQuery<UserImpl>(UserImpl.class);
-
- return new LazyPageList(new SimpleJDBCUserListAccess(this, dbQuery.toQuery(), dbQuery.toCountQuery()), pageSize);
+ return new SimpleJDBCUserListAccess(this, dbQuery.toQuery(), dbQuery.toCountQuery());
}
public User removeUser(String userName, boolean broadcast) throws Exception
Modified: core/trunk/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/UserDAOImpl.java
===================================================================
--- core/trunk/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/UserDAOImpl.java 2010-01-18 16:23:05 UTC (rev 1469)
+++ core/trunk/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/UserDAOImpl.java 2010-01-18 23:01:45 UTC (rev 1470)
@@ -19,11 +19,9 @@
package org.exoplatform.services.organization.ldap;
import org.exoplatform.commons.utils.LazyPageList;
+import org.exoplatform.commons.utils.ListAccess;
import org.exoplatform.services.ldap.LDAPService;
-import org.exoplatform.services.organization.Query;
-import org.exoplatform.services.organization.User;
-import org.exoplatform.services.organization.UserEventListener;
-import org.exoplatform.services.organization.UserHandler;
+import org.exoplatform.services.organization.*;
import org.exoplatform.services.organization.impl.UserImpl;
import java.util.ArrayList;
@@ -271,10 +269,15 @@
}
}
- /**
+ public LazyPageList<User> findUsersByGroup(String groupId) throws Exception
+ {
+ return new LazyPageList<User>(findUsersByGroupId(groupId), 10);
+ }
+
+ /**
* {@inheritDoc}
*/
- public LazyPageList<User> findUsersByGroup(String groupId) throws Exception
+ public ListAccess<User> findUsersByGroupId(String groupId) throws Exception
{
// ArrayList<User> users = new ArrayList<User>();
// TreeMap<String, User> map = new TreeMap<String, User>();
@@ -323,30 +326,36 @@
String searchBase = this.getGroupDNFromGroupId(groupId);
String filter = ldapAttrMapping.membershipObjectClassFilter;
- LazyPageList<User> l =
- new LazyPageList<User>(new ByGroupLdapUserListAccess(ldapAttrMapping, ldapService, searchBase, filter), 10);
- return l;
+ return new ByGroupLdapUserListAccess(ldapAttrMapping, ldapService, searchBase, filter);
}
- /**
+ public LazyPageList<User> getUserPageList(int pageSize) throws Exception
+ {
+ return new LazyPageList<User>(findAllUsers(), 10);
+ }
+
+ /**
* {@inheritDoc}
*/
- public LazyPageList<User> getUserPageList(int pageSize) throws Exception
+ public ListAccess<User> findAllUsers() throws Exception
{
String searchBase = ldapAttrMapping.userURL;
String filter = ldapAttrMapping.userObjectClassFilter;
// return new LDAPUserPageList(ldapAttrMapping, ldapService, searchBase, filter, pageSize);
- LazyPageList<User> l =
- new LazyPageList<User>(new SimpleLdapUserListAccess(ldapAttrMapping, ldapService, searchBase, filter), 10);
- return l;
+ return new SimpleLdapUserListAccess(ldapAttrMapping, ldapService, searchBase, filter);
}
+ public LazyPageList<User> findUsers(Query q) throws Exception
+ {
+ return new LazyPageList<User>(findUsersByQuery(q), 10);
+ }
+
/**
* {@inheritDoc}
*/
- public LazyPageList<User> findUsers(Query q) throws Exception
+ public ListAccess<User> findUsersByQuery(Query q) throws Exception
{
String filter = null;
ArrayList<String> list = new ArrayList<String>();
@@ -393,9 +402,7 @@
// return new LDAPUserPageList(ldapAttrMapping, ldapService, searchBase, filter, 20);
- LazyPageList<User> l =
- new LazyPageList<User>(new SimpleLdapUserListAccess(ldapAttrMapping, ldapService, searchBase, filter), 10);
- return l;
+ return new SimpleLdapUserListAccess(ldapAttrMapping, ldapService, searchBase, filter);
}
/**
16 years, 3 months
exo-jcr SVN: r1469 - jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2010-01-18 11:23:05 -0500 (Mon, 18 Jan 2010)
New Revision: 1469
Modified:
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jcr-config.xml
Log:
EXOJCR-406 : The cluster configuraation was changed to using CacheableLockManager.
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jcr-config.xml
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jcr-config.xml 2010-01-18 16:20:24 UTC (rev 1468)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jcr-config.xml 2010-01-18 16:23:05 UTC (rev 1469)
@@ -78,12 +78,12 @@
<property name="changesfilter-config-path" value="conf/cluster/test-jbosscache-indexer-config-exoloader_db1_ws.xml" />
</properties>
</query-handler>
- <!-- lock-manager class="org.exoplatform.services.jcr.impl.core.lock.jbosscache.CacheableLockManager">
+ <lock-manager class="org.exoplatform.services.jcr.impl.core.lock.jbosscache.CacheableLockManager">
<properties>
<property name="time-out" value="15m" />
<property name="jbosscache-configuration" value="conf/cluster/test-jbosscache-lock-config_db1_ws.xml" />
</properties>
- </lock-manager -->
+ </lock-manager>
</workspace>
<workspace name="ws1">
@@ -119,12 +119,12 @@
<property name="changesfilter-config-path" value="conf/cluster/test-jbosscache-indexer-config-exoloader_db1_ws1.xml" />
</properties>
</query-handler>
- <!-- lock-manager class="org.exoplatform.services.jcr.impl.core.lock.jbosscache.CacheableLockManager">
+ <lock-manager class="org.exoplatform.services.jcr.impl.core.lock.jbosscache.CacheableLockManager">
<properties>
<property name="time-out" value="15m" />
<property name="jbosscache-configuration" value="conf/cluster/test-jbosscache-lock-config_db1_ws1.xml" />
</properties>
- </lock-manager -->
+ </lock-manager>
</workspace>
</workspaces>
</repository>
16 years, 3 months
exo-jcr SVN: r1468 - jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2010-01-18 11:20:24 -0500 (Mon, 18 Jan 2010)
New Revision: 1468
Modified:
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManager.java
Log:
EXOJCR-412 : The skiping delete locks properties (jcr:lockIsDeep, jcr:lockOwner) if not exists was added.
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManager.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManager.java 2010-01-18 15:02:23 UTC (rev 1467)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManager.java 2010-01-18 16:20:24 UTC (rev 1468)
@@ -688,10 +688,25 @@
ItemData lockOwner =
copyItemData((PropertyData)dataManager.getItemData(nData, new QPathEntry(Constants.JCR_LOCKOWNER, 1)));
+ //TODO EXOJCR-412, should be refactored in future.
+ //Skip removing, because that lock was removed in other node of cluster.
+ if (lockOwner == null)
+ {
+ return;
+ }
+
changesLog.add(ItemState.createDeletedState(lockOwner));
ItemData lockIsDeep =
copyItemData((PropertyData)dataManager.getItemData(nData, new QPathEntry(Constants.JCR_LOCKISDEEP, 1)));
+
+ //TODO EXOJCR-412, should be refactored in future.
+ //Skip removing, because that lock was removed in other node of cluster.
+ if (lockIsDeep == null)
+ {
+ return;
+ }
+
changesLog.add(ItemState.createDeletedState(lockIsDeep));
// lock probably removed by other thread
16 years, 3 months
exo-jcr SVN: r1467 - jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2010-01-18 10:02:23 -0500 (Mon, 18 Jan 2010)
New Revision: 1467
Modified:
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-lock-config_db1_ws.xml
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-lock-config_db1_ws1.xml
Log:
EXOJCR-406 : The config to CacheableLockManager was changed to cluster configuraation.
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-lock-config_db1_ws.xml
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-lock-config_db1_ws.xml 2010-01-18 14:53:43 UTC (rev 1466)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-lock-config_db1_ws.xml 2010-01-18 15:02:23 UTC (rev 1467)
@@ -46,8 +46,8 @@
<sync />
</clustering>
- <!-- loaders passivation="false" shared="false">
- <loader class="org.jboss.cache.loader.JDBCCacheLoader" async="false" fetchPersistentState="true"
+ <loaders passivation="false" shared="false">
+ <loader class="org.jboss.cache.loader.JDBCCacheLoader" async="false" fetchPersistentState="false"
ignoreModifications="false" purgeOnStartup="false">
<properties>
cache.jdbc.table.name=jcrlocks_db1_ws
@@ -66,6 +66,6 @@
</properties>
</loader>
- </loaders -->
+ </loaders>
</jbosscache>
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-lock-config_db1_ws1.xml
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-lock-config_db1_ws1.xml 2010-01-18 14:53:43 UTC (rev 1466)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-lock-config_db1_ws1.xml 2010-01-18 15:02:23 UTC (rev 1467)
@@ -46,8 +46,8 @@
<sync />
</clustering>
- <!-- loaders passivation="false" shared="false">
- <loader class="org.jboss.cache.loader.JDBCCacheLoader" async="false" fetchPersistentState="true"
+ <loaders passivation="false" shared="false">
+ <loader class="org.jboss.cache.loader.JDBCCacheLoader" async="false" fetchPersistentState="false"
ignoreModifications="false" purgeOnStartup="false">
<properties>
cache.jdbc.table.name=jcrlocks_db1_ws1
@@ -66,6 +66,6 @@
</properties>
</loader>
- </loaders -->
+ </loaders>
</jbosscache>
16 years, 3 months
exo-jcr SVN: r1466 - jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/lab/cluster/prepare.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2010-01-18 09:53:43 -0500 (Mon, 18 Jan 2010)
New Revision: 1466
Modified:
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/lab/cluster/prepare/TestLoadIndexerWriterWithModes.java
Log:
EXOJCR-402: Allow to make all the thread wait and release them by pressing enter
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/lab/cluster/prepare/TestLoadIndexerWriterWithModes.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/lab/cluster/prepare/TestLoadIndexerWriterWithModes.java 2010-01-18 14:40:17 UTC (rev 1465)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/lab/cluster/prepare/TestLoadIndexerWriterWithModes.java 2010-01-18 14:53:43 UTC (rev 1466)
@@ -26,6 +26,8 @@
import java.io.InputStreamReader;
import java.util.Random;
import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.CyclicBarrier;
+import java.util.concurrent.atomic.AtomicBoolean;
import javax.jcr.Node;
import javax.jcr.RepositoryException;
@@ -44,15 +46,19 @@
public static final String STATISTIC = "Statistic";
private volatile boolean stop = false;
+
+ private AtomicBoolean makeThemWait = new AtomicBoolean();
- private int threadCount = 20;
+ private int threadCount = 10;
- // private int threadCount = 50;
-
private final CountDownLatch startSignal = new CountDownLatch(1);
private final CountDownLatch doneSignal = new CountDownLatch(threadCount);
+ private final CyclicBarrier barrier = new CyclicBarrier(threadCount);
+
+ private volatile CountDownLatch goSignal;
+
private static final String[] words =
new String[]{"private", "branch", "final", "string", "logging", "bottle", "property", "node", "repository",
"exception", "cycle", "value", "index", "meaning", "strange", "words", "hello", "outline", "finest",
@@ -60,42 +66,44 @@
public void testWrite() throws Exception
{
- try
+ log.info("Skip (y/n) :");
+ BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
+ String line = reader.readLine();
+ if (!line.equals("y"))
{
- System.out.println("Skip (y/n) :");
- BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
- String line = reader.readLine();
- if (!line.equals("y"))
+ log.info("Creating threads...");
+ for (int i = 0; i < threadCount; i++)
{
- log.info("Creating threads...");
- for (int i = 0; i < threadCount; i++)
+ // create new thread and start it
+ new Thread(new WriterTask(i)).start();
+ log.info("Thread#" + i + " created and started.");
+ }
+ startSignal.countDown();
+ while (true)
+ {
+ log.info("Type s to stop and return to make the threads wait or to release them :");
+ line = reader.readLine();
+ if (line.equalsIgnoreCase("s"))
{
- // create new thread and start it
- new Thread(new WriterTask(i)).start();
- log.info("Thread#" + i + " created and started.");
+ break;
}
- startSignal.countDown();
- // wait 5 minutes
- try
+ else if (makeThemWait.get())
{
- Thread.sleep(60000 * 500);
+ makeThemWait.set(false);
+ goSignal.countDown();
}
- catch (InterruptedException e)
+ else
{
- log.error(e);
+ goSignal = new CountDownLatch(1);
+ makeThemWait.set(true);
}
+ }
- stop = true;
- }
- else
- {
- log.info("Wait for data");
- }
+ stop = true;
}
- catch (Exception e)
+ else
{
- // TODO Auto-generated catch block
- e.printStackTrace();
+ log.info("Wait for data");
}
doneSignal.await();
@@ -140,39 +148,50 @@
startSignal.await();
while (!stop)
{
+ long time = System.currentTimeMillis();
+ // get any word
+ int i = random.nextInt(words.length);
+ String word = words[i] + id; // "hello12" if thread#12 is creating it
try
{
-
- long time = System.currentTimeMillis();
- // get any word
- int i = random.nextInt(words.length);
- String word = words[i] + id; // "hello12" if thread#12 is creating it
// update statistic
updateStatistic(word);
// add actual node
createTree().addNode(word);
sessionLocal.save();
- log.info(Thread.currentThread() + " time : " + (System.currentTimeMillis() - time));
+ System.out.println(Thread.currentThread() + " time : " + (System.currentTimeMillis() - time));
+ }
+ catch (Exception e1)
+ {
+ log.error("An error occurs", e1);
+ }
- // try
- // {
- // Thread.sleep(300);
- // }
- // catch (InterruptedException e)
- // {
- // }
+ try
+ {
+ if (makeThemWait.get())
+ {
+ barrier.await();
+ log.info("The threads are waiting for the go signal");
+ goSignal.await();
+ }
+ else
+ {
+ Thread.sleep(300);
+ }
}
- catch (Exception e)
+ catch (InterruptedException e)
{
- log.error("An unexpected error happens", e);
}
}
}
- catch (InterruptedException e)
+ catch (Exception e)
{
+ log.error("An unexpected error happens", e);
+ }
+ finally
+ {
doneSignal.countDown();
}
-
}
/**
16 years, 3 months