Skip to content
This repository has been archived by the owner on Apr 8, 2019. It is now read-only.

Commit

Permalink
GTNPORTAL-3390 : Migration to JCR 1.16.0-Alpha4
Browse files Browse the repository at this point in the history
  • Loading branch information
vietj committed Jan 31, 2014
1 parent efb9a3a commit 722675f
Show file tree
Hide file tree
Showing 60 changed files with 981 additions and 527 deletions.
2 changes: 1 addition & 1 deletion component/common/pom.xml
Expand Up @@ -42,7 +42,7 @@

<dependency>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>exo.kernel.component.ext.cache.impl.jboss.v3</artifactId>
<artifactId>exo.kernel.component.ext.cache.impl.infinispan.v5</artifactId>
</dependency>
<dependency>
<groupId>org.exoplatform.core</groupId>
Expand Down
Expand Up @@ -35,12 +35,12 @@ gatein.jcr.datasource.password=

gatein.jcr.data.dir=${gatein.data.dir}/jcr
gatein.jcr.storage.data.dir=${gatein.jcr.data.dir}/values
gatein.jcr.cache.config=war:/conf/jcr/jbosscache/${gatein.jcr.config.type}/config.xml
gatein.jcr.cache.config.workspace.portal-system=war:/conf/jcr/jbosscache/${gatein.jcr.config.type}/config_portal-system.xml
gatein.jcr.lock.cache.config=war:/conf/jcr/jbosscache/${gatein.jcr.config.type}/lock-config.xml
gatein.jcr.cache.config=war:/conf/jcr/infinispan/${gatein.jcr.config.type}/config.xml
gatein.jcr.cache.config.workspace.portal-system=war:/conf/jcr/infinispan/${gatein.jcr.config.type}/config_portal-system.xml
gatein.jcr.lock.cache.config=war:/conf/jcr/infinispan/${gatein.jcr.config.type}/lock-config.xml
gatein.jcr.index.data.dir=${gatein.jcr.data.dir}/lucene
gatein.jcr.index.changefilterclass=org.exoplatform.services.jcr.impl.core.query.DefaultChangesFilter
gatein.jcr.index.cache.config=war:/conf/jcr/jbosscache/cluster/indexer-config.xml
gatein.jcr.index.cache.config=war:/conf/jcr/infinispan/cluster/indexer-config.xml
gatein.jcr.jgroups.config=classpath:/jgroups/gatein-${gatein.default.jgroups.stack:udp}.xml
gatein.jcr.db-structure-type=isolated

Expand Down
Expand Up @@ -35,12 +35,12 @@ gatein.jcr.datasource.password=

gatein.jcr.data.dir=${gatein.data.dir}/jcr
gatein.jcr.storage.data.dir=${gatein.jcr.data.dir}/values
gatein.jcr.cache.config=war:/conf/jcr/jbosscache/${gatein.jcr.config.type}/config.xml
gatein.jcr.cache.config.workspace.portal-system=war:/conf/jcr/jbosscache/${gatein.jcr.config.type}/config_portal-system.xml
gatein.jcr.lock.cache.config=war:/conf/jcr/jbosscache/${gatein.jcr.config.type}/lock-config.xml
gatein.jcr.cache.config=war:/conf/jcr/infinispan/${gatein.jcr.config.type}/config.xml
gatein.jcr.cache.config.workspace.portal-system=war:/conf/jcr/infinispan/${gatein.jcr.config.type}/config_portal-system.xml
gatein.jcr.lock.cache.config=war:/conf/jcr/infinispan/${gatein.jcr.config.type}/lock-config.xml
gatein.jcr.index.data.dir=${gatein.jcr.data.dir}/lucene
gatein.jcr.index.changefilterclass=org.exoplatform.services.jcr.impl.core.query.DefaultChangesFilter
gatein.jcr.index.cache.config=war:/conf/jcr/jbosscache/cluster/indexer-config.xml
gatein.jcr.index.cache.config=war:/conf/jcr/infinispan/cluster/indexer-config.xml
gatein.jcr.jgroups.config=classpath:/jgroups/gatein-${gatein.default.jgroups.stack:udp}.xml
gatein.jcr.db-structure-type=isolated

Expand Down
Expand Up @@ -35,12 +35,12 @@ gatein.jcr.datasource.password=

gatein.jcr.data.dir=${gatein.data.dir}/jcr
gatein.jcr.storage.data.dir=${gatein.jcr.data.dir}/values
gatein.jcr.cache.config=war:/conf/jcr/jbosscache/${gatein.jcr.config.type}/config.xml
gatein.jcr.cache.config.workspace.portal-system=war:/conf/jcr/jbosscache/${gatein.jcr.config.type}/config_portal-system.xml
gatein.jcr.lock.cache.config=war:/conf/jcr/jbosscache/${gatein.jcr.config.type}/lock-config.xml
gatein.jcr.cache.config=war:/conf/jcr/infinispan/${gatein.jcr.config.type}/config.xml
gatein.jcr.cache.config.workspace.portal-system=war:/conf/jcr/infinispan/${gatein.jcr.config.type}/config_portal-system.xml
gatein.jcr.lock.cache.config=war:/conf/jcr/infinispan/${gatein.jcr.config.type}/lock-config.xml
gatein.jcr.index.data.dir=${gatein.jcr.data.dir}/lucene
gatein.jcr.index.changefilterclass=org.exoplatform.services.jcr.impl.core.query.DefaultChangesFilter
gatein.jcr.index.cache.config=war:/conf/jcr/jbosscache/cluster/indexer-config.xml
gatein.jcr.index.cache.config=war:/conf/jcr/infinispan/cluster/indexer-config.xml
gatein.jcr.jgroups.config=classpath:/jgroups/gatein-${gatein.default.jgroups.stack:udp}.xml
gatein.jcr.db-structure-type=isolated

Expand Down
Expand Up @@ -20,13 +20,17 @@
package org.exoplatform.commons.cache;

import java.io.Serializable;
import java.util.Collections;
import java.util.Set;
import java.util.concurrent.Callable;

import org.exoplatform.services.cache.ExoCache;
import org.exoplatform.services.cache.ExoCacheConfig;
import org.exoplatform.services.cache.ExoCacheInitException;
import org.exoplatform.services.cache.concurrent.ConcurrentFIFOExoCache;
import org.exoplatform.services.cache.impl.jboss.ExoCacheCreator;
import org.jboss.cache.Cache;
import org.exoplatform.services.cache.impl.infinispan.ExoCacheCreator;
import org.infinispan.Cache;
import org.infinispan.configuration.cache.ConfigurationBuilder;

/**
* Gives more flexibility in GateIn cache usage.
Expand All @@ -35,21 +39,23 @@
* @version $Revision$
*/
public class SimpleExoCacheCreator implements ExoCacheCreator {
public ExoCache<Serializable, Object> create(ExoCacheConfig config, Cache<Serializable, Object> jbossCache)
throws ExoCacheInitException {
ExoCache<Serializable, Object> simple = new ConcurrentFIFOExoCache<Serializable, Object>();
simple.setName(config.getName());
simple.setLabel(config.getLabel());
simple.setMaxSize(config.getMaxSize());
simple.setLiveTime(config.getLiveTime());
return simple;
}

public Class<? extends ExoCacheConfig> getExpectedConfigType() {
@Override
public ExoCache<Serializable, Object> create(ExoCacheConfig config, ConfigurationBuilder confBuilder, Callable<Cache<Serializable, Object>> cacheGetter) throws ExoCacheInitException {
ExoCache<Serializable, Object> simple = new ConcurrentFIFOExoCache<Serializable, Object>();
simple.setName(config.getName());
simple.setLabel(config.getLabel());
simple.setMaxSize(config.getMaxSize());
simple.setLiveTime(config.getLiveTime());
return simple;
}

public Class<? extends ExoCacheConfig> getExpectedConfigType() {
return ExoCacheConfig.class;
}

public String getExpectedImplementation() {
return "simple";
}
@Override
public Set<String> getExpectedImplementations() {
return Collections.singleton("simple");
}
}
7 changes: 7 additions & 0 deletions component/identity/pom.xml
Expand Up @@ -81,6 +81,13 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.exoplatform.core</groupId>
<artifactId>exo.core.component.organization.tests</artifactId>
<version>${org.exoplatform.core.version}</version>
<type>jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.exoplatform.core</groupId>
<artifactId>exo.core.component.organization.tests</artifactId>
Expand Down
Expand Up @@ -24,9 +24,9 @@

import org.exoplatform.commons.utils.ListAccess;
import org.exoplatform.container.ExoContainerContext;
import org.exoplatform.container.PortalContainer;
import org.exoplatform.services.organization.OrganizationService;
import org.exoplatform.services.organization.User;
import org.exoplatform.services.organization.UserStatus;
import org.gatein.common.logging.LogLevel;
import org.gatein.common.logging.Logger;
import org.gatein.common.logging.LoggerFactory;
Expand All @@ -46,19 +46,19 @@ public class IDMUserListAccess implements ListAccess<User>, Serializable {

private final boolean countAll;

private final boolean enabledOnly;
private final UserStatus userStatus;

private List<org.picketlink.idm.api.User> fullResults;

private int size = -1;

private User lastExisting;

public IDMUserListAccess(UserQueryBuilder userQueryBuilder, int pageSize, boolean countAll, boolean enabledOnly) {
public IDMUserListAccess(UserQueryBuilder userQueryBuilder, int pageSize, boolean countAll, UserStatus userStatus) {
this.userQueryBuilder = userQueryBuilder;
this.pageSize = pageSize;
this.countAll = countAll;
this.enabledOnly = enabledOnly;
this.userStatus = userStatus;
}

public User[] load(int index, int length) throws Exception {
Expand Down
@@ -1,6 +1,7 @@
package org.exoplatform.services.organization.idm;

import org.exoplatform.services.organization.Query;
import org.exoplatform.services.organization.UserStatus;
import org.gatein.common.NotYetImplemented;
import org.gatein.common.logging.Logger;
import org.gatein.common.logging.LoggerFactory;
Expand Down Expand Up @@ -117,8 +118,8 @@ String getGtnGroupId(String ns, String pLIDMId) {
* @param query
* @param list
*/
void putGtnUserLazyPageList(String ns, Query query, IDMUserListAccess list, boolean enabledOnly) {
Fqn nodeFqn = getFqn(ns, USER_QUERY_NODE, getQueryKey(query, enabledOnly));
void putGtnUserLazyPageList(String ns, Query query, IDMUserListAccess list, UserStatus userStatus) {
Fqn nodeFqn = getFqn(ns, USER_QUERY_NODE, getQueryKey(query, userStatus));

Node ioNode = addNode(nodeFqn);

Expand All @@ -127,7 +128,7 @@ void putGtnUserLazyPageList(String ns, Query query, IDMUserListAccess list, bool

if (log.isTraceEnabled()) {

log.trace(this.toString() + "GateIn user query list cached. Query: " + getQueryKey(query, enabledOnly) + ";namespace=" + ns);
log.trace(this.toString() + "GateIn user query list cached. Query: " + getQueryKey(query, userStatus) + ";namespace=" + ns);
}
}
}
Expand All @@ -139,17 +140,17 @@ void putGtnUserLazyPageList(String ns, Query query, IDMUserListAccess list, bool
* @param query
* @return LazyPageList
*/
IDMUserListAccess getGtnUserLazyPageList(String ns, Query query, boolean enabledOnly) {
IDMUserListAccess getGtnUserLazyPageList(String ns, Query query, UserStatus userStatus) {

Fqn nodeFqn = getFqn(ns, USER_QUERY_NODE, getQueryKey(query, enabledOnly));
Fqn nodeFqn = getFqn(ns, USER_QUERY_NODE, getQueryKey(query, userStatus));

Node node = getNode(nodeFqn);

if (node != null) {
IDMUserListAccess list = (IDMUserListAccess) node.get(NODE_OBJECT_KEY);

if (log.isTraceEnabled() && list != null) {
log.trace(this.toString() + "GateIn user query list found in cache. Query: " + getQueryKey(query, enabledOnly)
log.trace(this.toString() + "GateIn user query list found in cache. Query: " + getQueryKey(query, userStatus)
+ ";namespace=" + ns);
}

Expand Down Expand Up @@ -206,13 +207,23 @@ Group getRootGroup(String ns) {

}

String getQueryKey(Query query, boolean enabledOnly) {
String getQueryKey(Query query, UserStatus userStatus) {
StringBuilder sb = new StringBuilder();
String SEP = ":::";

sb.append(query.getEmail()).append(SEP).append(query.getFirstName()).append(SEP).append(query.getLastName())
.append(SEP).append(query.getUserName()).append(SEP).append(query.getFromLoginDate()).append(SEP)
.append(query.getToLoginDate()).append(SEP).append(enabledOnly).append(SEP);
if (userStatus == UserStatus.BOTH) {
/*
sb.append(query.getEmail()).append(SEP).append(query.getFirstName()).append(SEP).append(query.getLastName())
.append(SEP).append(query.getUserName()).append(SEP).append(query.getFromLoginDate()).append(SEP)
.append(query.getToLoginDate()).append(SEP);
*/
throw new UnsupportedOperationException("Implement me");
} else {
boolean enabledOnly = userStatus == UserStatus.ENABLED;
sb.append(query.getEmail()).append(SEP).append(query.getFirstName()).append(SEP).append(query.getLastName())
.append(SEP).append(query.getUserName()).append(SEP).append(query.getFromLoginDate()).append(SEP)
.append(query.getToLoginDate()).append(SEP).append(enabledOnly).append(SEP);
}

return sb.toString();
}
Expand Down

0 comments on commit 722675f

Please sign in to comment.