exo-jcr SVN: r3097 - jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan.
by do-not-reply@jboss.org
Author: tolusha
Date: 2010-09-09 08:58:23 -0400 (Thu, 09 Sep 2010)
New Revision: 3097
Modified:
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/BufferedISPNCache.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java
Log:
EXOJCR-830: apply remarks
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/BufferedISPNCache.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/BufferedISPNCache.java 2010-09-09 10:28:10 UTC (rev 3096)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/BufferedISPNCache.java 2010-09-09 12:58:23 UTC (rev 3097)
@@ -23,6 +23,7 @@
import org.infinispan.AdvancedCache;
import org.infinispan.Cache;
import org.infinispan.config.Configuration;
+import org.infinispan.config.Configuration.CacheMode;
import org.infinispan.context.Flag;
import org.infinispan.lifecycle.ComponentStatus;
import org.infinispan.manager.CacheContainer;
@@ -51,12 +52,17 @@
/**
* Parent cache.
*/
- private final Cache<Serializable, Object> parentCache;
+ private final AdvancedCache<Serializable, Object> parentCache;
private final ThreadLocal<CompressedISPNChangesBuffer> changesList = new ThreadLocal<CompressedISPNChangesBuffer>();
private ThreadLocal<Boolean> local = new ThreadLocal<Boolean>();
+ /**
+ * Allow to perform local cache changes.
+ */
+ private final Boolean allowLocalChanges;
+
protected static final Log LOG = ExoLogger.getLogger("exo.jcr.component.core.BufferedISPNCache");
public static enum ChangesType {
@@ -72,21 +78,23 @@
protected final ChangesType changesType;
- protected final Cache<Serializable, Object> cache;
+ protected final AdvancedCache<Serializable, Object> cache;
protected final int historicalIndex;
protected final boolean localMode;
- public ChangesContainer(CacheKey key, ChangesType changesType, Cache<Serializable, Object> cache,
- int historicalIndex, boolean localMode)
+ private final Boolean allowLocalChanges;
+
+ public ChangesContainer(CacheKey key, ChangesType changesType, AdvancedCache<Serializable, Object> cache,
+ int historicalIndex, boolean localMode, Boolean allowLocalChanges)
{
- super();
this.key = key;
this.changesType = changesType;
this.cache = cache;
this.historicalIndex = historicalIndex;
this.localMode = localMode;
+ this.allowLocalChanges = allowLocalChanges;
}
/**
@@ -119,7 +127,7 @@
@Override
public String toString()
{
- return key.toString() + " type=" + changesType + " historyIndex=" + historicalIndex;
+ return key.toString() + " type=" + changesType + " historysIndex=" + historicalIndex;
}
/**
@@ -135,19 +143,18 @@
{
if (localMode)
{
- cache.getAdvancedCache().getInvocationContextContainer().getInvocationContext().setFlags(
- Flag.CACHE_MODE_LOCAL);
- }
- else
- {
- Set<Flag> flags =
- cache.getAdvancedCache().getInvocationContextContainer().getInvocationContext().getFlags();
-
- if (flags != null)
+ if (allowLocalChanges == null)
{
- flags.remove(Flag.CACHE_MODE_LOCAL);
- cache.getAdvancedCache().getInvocationContextContainer().getInvocationContext().setFlags(flags);
+ CacheMode cacheMode = cache.getConfiguration().getCacheMode();
+ if (cacheMode != CacheMode.DIST_ASYNC && cacheMode != CacheMode.DIST_SYNC)
+ {
+ cache.withFlags(Flag.CACHE_MODE_LOCAL);
+ }
}
+ else if (allowLocalChanges)
+ {
+ cache.withFlags(Flag.CACHE_MODE_LOCAL);
+ }
}
}
@@ -161,10 +168,10 @@
{
private final Object value;
- public PutObjectContainer(CacheKey key, Object value, Cache<Serializable, Object> cache, int historicalIndex,
- boolean local)
+ public PutObjectContainer(CacheKey key, Object value, AdvancedCache<Serializable, Object> cache,
+ int historicalIndex, boolean local, Boolean allowLocalChanges)
{
- super(key, ChangesType.PUT, cache, historicalIndex, local);
+ super(key, ChangesType.PUT, cache, historicalIndex, local, allowLocalChanges);
this.value = value;
}
@@ -185,10 +192,10 @@
{
private final Object value;
- public AddToListContainer(CacheKey key, Object value, Cache<Serializable, Object> cache, int historicalIndex,
- boolean local)
+ public AddToListContainer(CacheKey key, Object value, AdvancedCache<Serializable, Object> cache,
+ int historicalIndex, boolean local, Boolean allowLocalChanges)
{
- super(key, ChangesType.PUT, cache, historicalIndex, local);
+ super(key, ChangesType.PUT, cache, historicalIndex, local, allowLocalChanges);
this.value = value;
}
@@ -196,8 +203,7 @@
public void apply()
{
// force writeLock on next read
- cache.getAdvancedCache().getInvocationContextContainer().getInvocationContext()
- .setFlags(Flag.FORCE_WRITE_LOCK);
+ cache.withFlags(Flag.FORCE_WRITE_LOCK);
Object existingObject = cache.get(key);
Set<Object> newSet = new HashSet<Object>();
@@ -231,10 +237,10 @@
{
private final Object value;
- public RemoveFromListContainer(CacheKey key, Object value, Cache<Serializable, Object> cache,
- int historicalIndex, boolean local)
+ public RemoveFromListContainer(CacheKey key, Object value, AdvancedCache<Serializable, Object> cache,
+ int historicalIndex, boolean local, Boolean allowLocalChanges)
{
- super(key, ChangesType.REMOVE, cache, historicalIndex, local);
+ super(key, ChangesType.REMOVE, cache, historicalIndex, local, allowLocalChanges);
this.value = value;
}
@@ -242,11 +248,9 @@
public void apply()
{
// force writeLock on next read
- cache.getAdvancedCache().getInvocationContextContainer().getInvocationContext()
- .setFlags(Flag.FORCE_WRITE_LOCK);
+ cache.withFlags(Flag.FORCE_WRITE_LOCK);
setCacheLocalMode();
-
Object existingObject = cache.get(key);
// if found value is really set! add to it.
@@ -266,9 +270,10 @@
*/
public static class RemoveObjectContainer extends ChangesContainer
{
- public RemoveObjectContainer(CacheKey key, Cache<Serializable, Object> cache, int historicalIndex, boolean local)
+ public RemoveObjectContainer(CacheKey key, AdvancedCache<Serializable, Object> cache, int historicalIndex,
+ boolean local, Boolean allowLocalChanges)
{
- super(key, ChangesType.REMOVE, cache, historicalIndex, local);
+ super(key, ChangesType.REMOVE, cache, historicalIndex, local, allowLocalChanges);
}
@Override
@@ -279,16 +284,15 @@
}
}
- public BufferedISPNCache(Cache<Serializable, Object> parentCache)
+ public BufferedISPNCache(Cache<Serializable, Object> parentCache, Boolean allowLocalChanges)
{
- super();
- this.parentCache = parentCache;
+ this.parentCache = parentCache.getAdvancedCache();
+ this.allowLocalChanges = allowLocalChanges;
}
/**
* {@inheritDoc}
*/
- @Override
public NotifyingFuture<Void> clearAsync()
{
return parentCache.clearAsync();
@@ -297,7 +301,6 @@
/**
* {@inheritDoc}
*/
- @Override
public void compact()
{
parentCache.compact();
@@ -306,7 +309,6 @@
/**
* {@inheritDoc}
*/
- @Override
public void endBatch(boolean successful)
{
parentCache.endBatch(successful);
@@ -315,7 +317,6 @@
/**
* {@inheritDoc}
*/
- @Override
public Set<java.util.Map.Entry<Serializable, Object>> entrySet()
{
return parentCache.entrySet();
@@ -324,7 +325,6 @@
/**
* {@inheritDoc}
*/
- @Override
public void evict(Serializable key)
{
parentCache.evict(key);
@@ -333,7 +333,6 @@
/**
* {@inheritDoc}
*/
- @Override
public AdvancedCache<Serializable, Object> getAdvancedCache()
{
return parentCache.getAdvancedCache();
@@ -342,7 +341,6 @@
/**
* {@inheritDoc}
*/
- @Override
public CacheContainer getCacheManager()
{
return parentCache.getCacheManager();
@@ -351,7 +349,6 @@
/**
* {@inheritDoc}
*/
- @Override
public Configuration getConfiguration()
{
return parentCache.getConfiguration();
@@ -360,7 +357,6 @@
/**
* {@inheritDoc}
*/
- @Override
public String getName()
{
return parentCache.getName();
@@ -369,7 +365,6 @@
/**
* {@inheritDoc}
*/
- @Override
public ComponentStatus getStatus()
{
return parentCache.getStatus();
@@ -378,7 +373,6 @@
/**
* {@inheritDoc}
*/
- @Override
public String getVersion()
{
return parentCache.getVersion();
@@ -387,7 +381,6 @@
/**
* {@inheritDoc}
*/
- @Override
public Set<Serializable> keySet()
{
return parentCache.keySet();
@@ -396,7 +389,6 @@
/**
* {@inheritDoc}
*/
- @Override
public Object put(Serializable key, Object value, long lifespan, TimeUnit unit)
{
return parentCache.put(key, value, lifespan, unit);
@@ -405,7 +397,6 @@
/**
* {@inheritDoc}
*/
- @Override
public Object put(Serializable key, Object value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime,
TimeUnit maxIdleTimeUnit)
{
@@ -415,7 +406,6 @@
/**
* {@inheritDoc}
*/
- @Override
public void putAll(Map<? extends Serializable, ? extends Object> map, long lifespan, TimeUnit unit)
{
parentCache.putAll(map, lifespan, unit);
@@ -424,7 +414,6 @@
/**
* {@inheritDoc}
*/
- @Override
public void putAll(Map<? extends Serializable, ? extends Object> map, long lifespan, TimeUnit lifespanUnit,
long maxIdleTime, TimeUnit maxIdleTimeUnit)
{
@@ -434,7 +423,6 @@
/**
* {@inheritDoc}
*/
- @Override
public NotifyingFuture<Void> putAllAsync(Map<? extends Serializable, ? extends Object> data)
{
return parentCache.putAllAsync(data);
@@ -443,7 +431,6 @@
/**
* {@inheritDoc}
*/
- @Override
public NotifyingFuture<Void> putAllAsync(Map<? extends Serializable, ? extends Object> data, long lifespan,
TimeUnit unit)
{
@@ -453,7 +440,6 @@
/**
* {@inheritDoc}
*/
- @Override
public NotifyingFuture<Void> putAllAsync(Map<? extends Serializable, ? extends Object> data, long lifespan,
TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit)
{
@@ -463,7 +449,6 @@
/**
* {@inheritDoc}
*/
- @Override
public NotifyingFuture<Object> putAsync(Serializable key, Object value)
{
return parentCache.putAsync(key, value);
@@ -472,7 +457,6 @@
/**
* {@inheritDoc}
*/
- @Override
public NotifyingFuture<Object> putAsync(Serializable key, Object value, long lifespan, TimeUnit unit)
{
return parentCache.putAsync(key, value, lifespan, unit);
@@ -481,7 +465,6 @@
/**
* {@inheritDoc}
*/
- @Override
public NotifyingFuture<Object> putAsync(Serializable key, Object value, long lifespan, TimeUnit lifespanUnit,
long maxIdle, TimeUnit maxIdleUnit)
{
@@ -491,7 +474,6 @@
/**
* {@inheritDoc}
*/
- @Override
public void putForExternalRead(Serializable key, Object value)
{
parentCache.putForExternalRead(key, value);
@@ -500,7 +482,6 @@
/**
* {@inheritDoc}
*/
- @Override
public Object putIfAbsent(Serializable key, Object value, long lifespan, TimeUnit unit)
{
return parentCache.putIfAbsent(key, value, lifespan, unit);
@@ -509,7 +490,6 @@
/**
* {@inheritDoc}
*/
- @Override
public Object putIfAbsent(Serializable key, Object value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime,
TimeUnit maxIdleTimeUnit)
{
@@ -519,7 +499,6 @@
/**
* {@inheritDoc}
*/
- @Override
public NotifyingFuture<Object> putIfAbsentAsync(Serializable key, Object value)
{
return parentCache.putIfAbsentAsync(key, value);
@@ -528,7 +507,6 @@
/**
* {@inheritDoc}
*/
- @Override
public NotifyingFuture<Object> putIfAbsentAsync(Serializable key, Object value, long lifespan, TimeUnit unit)
{
return parentCache.putIfAbsentAsync(key, value, lifespan, unit);
@@ -537,7 +515,6 @@
/**
* {@inheritDoc}
*/
- @Override
public NotifyingFuture<Object> putIfAbsentAsync(Serializable key, Object value, long lifespan,
TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit)
{
@@ -547,7 +524,6 @@
/**
* {@inheritDoc}
*/
- @Override
public NotifyingFuture<Object> removeAsync(Object key)
{
return parentCache.removeAsync(key);
@@ -556,7 +532,6 @@
/**
* {@inheritDoc}
*/
- @Override
public NotifyingFuture<Boolean> removeAsync(Object key, Object value)
{
return parentCache.removeAsync(key, value);
@@ -565,7 +540,6 @@
/**
* {@inheritDoc}
*/
- @Override
public Object replace(Serializable key, Object value, long lifespan, TimeUnit unit)
{
return parentCache.replace(key, value, lifespan, unit);
@@ -574,7 +548,6 @@
/**
* {@inheritDoc}
*/
- @Override
public boolean replace(Serializable key, Object oldValue, Object value, long lifespan, TimeUnit unit)
{
return parentCache.replace(key, oldValue, value, lifespan, unit);
@@ -583,7 +556,6 @@
/**
* {@inheritDoc}
*/
- @Override
public Object replace(Serializable key, Object value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime,
TimeUnit maxIdleTimeUnit)
{
@@ -593,7 +565,6 @@
/**
* {@inheritDoc}
*/
- @Override
public boolean replace(Serializable key, Object oldValue, Object value, long lifespan, TimeUnit lifespanUnit,
long maxIdleTime, TimeUnit maxIdleTimeUnit)
{
@@ -603,7 +574,6 @@
/**
* {@inheritDoc}
*/
- @Override
public NotifyingFuture<Object> replaceAsync(Serializable key, Object value)
{
return parentCache.replaceAsync(key, value);
@@ -612,7 +582,6 @@
/**
* {@inheritDoc}
*/
- @Override
public NotifyingFuture<Boolean> replaceAsync(Serializable key, Object oldValue, Object newValue)
{
return parentCache.replaceAsync(key, oldValue, newValue);
@@ -621,7 +590,6 @@
/**
* {@inheritDoc}
*/
- @Override
public NotifyingFuture<Object> replaceAsync(Serializable key, Object value, long lifespan, TimeUnit unit)
{
return parentCache.replaceAsync(key, value, lifespan, unit);
@@ -630,7 +598,6 @@
/**
* {@inheritDoc}
*/
- @Override
public NotifyingFuture<Boolean> replaceAsync(Serializable key, Object oldValue, Object newValue, long lifespan,
TimeUnit unit)
{
@@ -640,7 +607,6 @@
/**
* {@inheritDoc}
*/
- @Override
public NotifyingFuture<Object> replaceAsync(Serializable key, Object value, long lifespan, TimeUnit lifespanUnit,
long maxIdle, TimeUnit maxIdleUnit)
{
@@ -650,7 +616,6 @@
/**
* {@inheritDoc}
*/
- @Override
public NotifyingFuture<Boolean> replaceAsync(Serializable key, Object oldValue, Object newValue, long lifespan,
TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit)
{
@@ -660,7 +625,6 @@
/**
* {@inheritDoc}
*/
- @Override
public boolean startBatch()
{
return parentCache.startBatch();
@@ -669,7 +633,6 @@
/**
* {@inheritDoc}
*/
- @Override
public Collection<Object> values()
{
return parentCache.values();
@@ -678,7 +641,6 @@
/**
* {@inheritDoc}
*/
- @Override
public Object putIfAbsent(Serializable key, Object value)
{
return parentCache.putIfAbsent(key, value);
@@ -687,7 +649,6 @@
/**
* {@inheritDoc}
*/
- @Override
public boolean remove(Object key, Object value)
{
return parentCache.remove(key, value);
@@ -696,7 +657,6 @@
/**
* {@inheritDoc}
*/
- @Override
public Object replace(Serializable key, Object value)
{
return parentCache.replace(key, value);
@@ -705,7 +665,6 @@
/**
* {@inheritDoc}
*/
- @Override
public boolean replace(Serializable key, Object oldValue, Object newValue)
{
return parentCache.replace(key, oldValue, newValue);
@@ -714,7 +673,6 @@
/**
* {@inheritDoc}
*/
- @Override
public void clear()
{
parentCache.clear();
@@ -723,7 +681,6 @@
/**
* {@inheritDoc}
*/
- @Override
public boolean containsKey(Object key)
{
return parentCache.containsKey(key);
@@ -732,7 +689,6 @@
/**
* {@inheritDoc}
*/
- @Override
public boolean containsValue(Object value)
{
return parentCache.containsValue(value);
@@ -741,7 +697,6 @@
/**
* {@inheritDoc}
*/
- @Override
public Object get(Object key)
{
return parentCache.get(key);
@@ -750,7 +705,6 @@
/**
* {@inheritDoc}
*/
- @Override
public boolean isEmpty()
{
return parentCache.isEmpty();
@@ -766,7 +720,7 @@
{
CompressedISPNChangesBuffer changesContainer = getChangesBufferSafe();
changesContainer.add(new PutObjectContainer(key, value, parentCache, changesContainer.getHistoryIndex(), local
- .get()));
+ .get(), allowLocalChanges));
return parentCache.get(key);
}
@@ -774,7 +728,6 @@
/**
* {@inheritDoc}
*/
- @Override
public Object put(Serializable key, Object value)
{
throw new UnsupportedOperationException("Unexpected method call use put(CacheKey key, Object value)");
@@ -783,7 +736,6 @@
/**
* {@inheritDoc}
*/
- @Override
public void putAll(Map<? extends Serializable, ? extends Object> m)
{
parentCache.putAll(m);
@@ -792,19 +744,17 @@
/**
* {@inheritDoc}
*/
- @Override
public Object remove(Object key)
{
CompressedISPNChangesBuffer changesContainer = getChangesBufferSafe();
changesContainer.add(new RemoveObjectContainer((CacheKey)key, parentCache, changesContainer.getHistoryIndex(),
- local.get()));
+ local.get(), allowLocalChanges));
return parentCache.get(key);
}
/**
* {@inheritDoc}
*/
- @Override
public int size()
{
return parentCache.size();
@@ -813,7 +763,6 @@
/**
* {@inheritDoc}
*/
- @Override
public void start()
{
PrivilegedAction<Object> action = new PrivilegedAction<Object>()
@@ -830,7 +779,6 @@
/**
* {@inheritDoc}
*/
- @Override
public void stop()
{
PrivilegedAction<Object> action = new PrivilegedAction<Object>()
@@ -847,7 +795,6 @@
/**
* {@inheritDoc}
*/
- @Override
public void addListener(Object listener)
{
parentCache.addListener(listener);
@@ -856,7 +803,6 @@
/**
* {@inheritDoc}
*/
- @Override
public Set<Object> getListeners()
{
return parentCache.getListeners();
@@ -865,7 +811,6 @@
/**
* {@inheritDoc}
*/
- @Override
public void removeListener(Object listener)
{
parentCache.removeListener(listener);
@@ -961,7 +906,7 @@
{
CompressedISPNChangesBuffer changesContainer = getChangesBufferSafe();
changesContainer.add(new AddToListContainer(key, value, parentCache, changesContainer.getHistoryIndex(), local
- .get()));
+ .get(), allowLocalChanges));
}
/**
@@ -978,7 +923,7 @@
Object prevObject = getObjectFromChangesContainer(changesContainer, key);
changesContainer.add(new PutObjectContainer(key, value, parentCache, changesContainer.getHistoryIndex(), local
- .get()));
+ .get(), allowLocalChanges));
if (prevObject != null)
{
@@ -1015,7 +960,7 @@
{
CompressedISPNChangesBuffer changesContainer = getChangesBufferSafe();
changesContainer.add(new RemoveFromListContainer(key, value, parentCache, changesContainer.getHistoryIndex(),
- local.get()));
+ local.get(), allowLocalChanges));
}
public Object getFromBuffer(CacheKey key)
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java 2010-09-09 10:28:10 UTC (rev 3096)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java 2010-09-09 12:58:23 UTC (rev 3097)
@@ -20,6 +20,7 @@
import org.exoplatform.container.configuration.ConfigurationManager;
import org.exoplatform.services.jcr.access.AccessControlList;
+import org.exoplatform.services.jcr.config.CacheEntry;
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
import org.exoplatform.services.jcr.config.WorkspaceEntry;
import org.exoplatform.services.jcr.dataflow.ItemState;
@@ -38,7 +39,6 @@
import org.exoplatform.services.jcr.infinispan.ISPNCacheFactory;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
-import org.exoplatform.services.transaction.TransactionService;
import org.infinispan.Cache;
import java.io.Serializable;
@@ -68,7 +68,7 @@
* Current state notes (subject of change):
* <ul>
* <li>cache implements WorkspaceStorageCache, without any stuff about references and locks</li>
- * <li>transaction style implemented via JBC barches, do with JTA (i.e. via exo's TransactionService + JBoss TM)</li>
+ * <li>transaction style implemented via batches, do with JTA (i.e. via exo's TransactionService + JBoss TM)</li>
* </ul>
*
* @author <a href="anatoliy.bazko(a)exoplatform.org">Anatoliy Bazko</a>
@@ -79,8 +79,6 @@
private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.core.ISPNCacheWorkspaceStorageCache");
- public static final String JBOSSCACHE_CONFIG = "infinispan-configuration";
-
protected final BufferedISPNCache cache;
/**
@@ -195,12 +193,11 @@
* Cache constructor with eXo TransactionService support.
*
* @param wsConfig WorkspaceEntry workspace config
- * @param transactionService TransactionService external transaction service
* @throws RepositoryException if error of initialization
* @throws RepositoryConfigurationException if error of configuration
*/
- public ISPNCacheWorkspaceStorageCache(WorkspaceEntry wsConfig, TransactionService transactionService,
- ConfigurationManager cfm) throws RepositoryException, RepositoryConfigurationException
+ public ISPNCacheWorkspaceStorageCache(WorkspaceEntry wsConfig, ConfigurationManager cfm) throws RepositoryException,
+ RepositoryConfigurationException
{
if (wsConfig.getCache() == null)
{
@@ -210,26 +207,23 @@
// create cache using custom factory
ISPNCacheFactory<Serializable, Object> factory = new ISPNCacheFactory<Serializable, Object>(cfm);
- // create parent JBossCache instance
- Cache<Serializable, Object> parentCache = factory.createCache(wsConfig.getCache());
+ // create parent Infinispan instance
+ CacheEntry cacheEntry = wsConfig.getCache();
+ Cache<Serializable, Object> parentCache = factory.createCache(cacheEntry);
- this.cache = new BufferedISPNCache(parentCache);
+ Boolean allowLocalChanges = null;
+ try
+ {
+ allowLocalChanges = cacheEntry.getParameterBoolean("allow-local-changes");
+ }
+ catch (RepositoryConfigurationException e)
+ {
+ // do n't nothing
+ }
+ this.cache = new BufferedISPNCache(parentCache, allowLocalChanges);
}
/**
- * Cache constructor with JBossCache JTA transaction support.
- *
- * @param wsConfig WorkspaceEntry workspace config
- * @throws RepositoryException if error of initialization
- * @throws RepositoryConfigurationException if error of configuration
- */
- public ISPNCacheWorkspaceStorageCache(WorkspaceEntry wsConfig, ConfigurationManager cfm) throws RepositoryException,
- RepositoryConfigurationException
- {
- this(wsConfig, null, cfm);
- }
-
- /**
* {@inheritDoc}
*/
public void put(ItemData item)
@@ -431,7 +425,8 @@
*/
public ItemData get(String parentId, QPathEntry name)
{
- return (ItemData)cache.get(new CacheQPath(parentId, name));
+ String id = (String)cache.get(new CacheQPath(parentId, name));
+ return get(id);
}
/**
@@ -603,7 +598,7 @@
}
}
- cache.put(new CacheQPath(node.getParentIdentifier(), node.getQPath()), node);
+ cache.put(new CacheQPath(node.getParentIdentifier(), node.getQPath()), node.getIdentifier());
return (ItemData)cache.put(new CacheId(node.getIdentifier()), node);
}
@@ -619,7 +614,7 @@
}
}
- cache.putInBuffer(new CacheQPath(node.getParentIdentifier(), node.getQPath()), node);
+ cache.putInBuffer(new CacheQPath(node.getParentIdentifier(), node.getQPath()), node.getIdentifier());
return (ItemData)cache.putInBuffer(new CacheId(node.getIdentifier()), node);
}
@@ -638,7 +633,7 @@
cache.addToList(new CachePropsId(prop.getParentIdentifier()), prop.getIdentifier());
}
- cache.put(new CacheQPath(prop.getParentIdentifier(), prop.getQPath()), prop);
+ cache.put(new CacheQPath(prop.getParentIdentifier(), prop.getQPath()), prop.getIdentifier());
return (PropertyData)cache.put(new CacheId(prop.getIdentifier()), prop);
}
@@ -646,6 +641,8 @@
{
cache.remove(new CacheId(item.getIdentifier()));
cache.remove(new CacheQPath(item.getParentIdentifier(), item.getQPath()));
+ cache.remove(new CacheNodesId(item.getIdentifier()));
+ cache.remove(new CachePropsId(item.getIdentifier()));
if (item.getParentIdentifier() != null)
{
@@ -668,7 +665,7 @@
protected void updateMixin(NodeData node)
{
NodeData prevData = (NodeData)cache.put(new CacheId(node.getIdentifier()), node);
- cache.put(new CacheQPath(node.getParentIdentifier(), node.getQPath()), node);
+ cache.put(new CacheQPath(node.getParentIdentifier(), node.getQPath()), node.getIdentifier());
if (prevData != null)
{
@@ -730,7 +727,7 @@
while (keys.hasNext())
{
CacheKey key = (CacheKey)keys.next();
- if (key instanceof CacheId || key instanceof CacheQPath)
+ if (key instanceof CacheId)
{
ItemData data = (ItemData)cache.get(key);
@@ -766,14 +763,7 @@
prevNode.getParentIdentifier(), inheritACL ? acl : prevNode.getACL());
// update this node
- if (key instanceof CacheId)
- {
- cache.put(new CacheId(newNode.getIdentifier()), newNode);
- }
- else
- {
- cache.put(new CacheQPath(newNode.getParentIdentifier(), newNode.getQPath()), newNode);
- }
+ cache.put(new CacheId(newNode.getIdentifier()), newNode);
}
else
{
@@ -793,14 +783,7 @@
.getValues());
// update this property
- if (key instanceof CacheId)
- {
- cache.put(new CacheId(newProp.getIdentifier()), newProp);
- }
- else
- {
- cache.put(new CacheQPath(newProp.getParentIdentifier(), newProp.getQPath()), newProp);
- }
+ cache.put(new CacheId(newProp.getIdentifier()), newProp);
}
}
}
@@ -837,7 +820,6 @@
// update this node
cache.put(new CacheId(newNode.getIdentifier()), newNode);
- cache.put(new CacheQPath(newNode.getIdentifier(), newNode.getQPath()), newNode);
// update childs recursive
updateChildsACL(newNode.getIdentifier(), acl);
15 years, 8 months
exo-jcr SVN: r3096 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2010-09-09 06:28:10 -0400 (Thu, 09 Sep 2010)
New Revision: 3096
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java
Log:
EXOJCR-752: NodeIndexer - all String are created with default encoding
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java 2010-09-09 06:56:47 UTC (rev 3095)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java 2010-09-09 10:28:10 UTC (rev 3096)
@@ -316,7 +316,8 @@
try
{
DocumentReader dreader =
- extractor.getDocumentReader(new String(pmime.getValues().get(0).getAsByteArray()));
+ extractor.getDocumentReader(new String(pmime.getValues().get(0).getAsByteArray(),
+ Constants.DEFAULT_ENCODING));
data = propData.getValues();
@@ -333,7 +334,7 @@
if (encProp != null)
{
// encoding parameter used
- encoding = new String(encProp.getValues().get(0).getAsByteArray());
+ encoding = new String(encProp.getValues().get(0).getAsByteArray(), Constants.DEFAULT_ENCODING);
}
if (dreader instanceof AdvancedDocumentReader)
15 years, 8 months
exo-jcr SVN: r3095 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2010-09-09 02:56:47 -0400 (Thu, 09 Sep 2010)
New Revision: 3095
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java
Log:
EXOJCR-940: RepositoryImpl.removeSystemWorkspace() added
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java 2010-09-08 16:34:20 UTC (rev 3094)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java 2010-09-09 06:56:47 UTC (rev 3095)
@@ -638,7 +638,7 @@
public void removeWorkspace(String workspaceName) throws RepositoryException
{
if (!canRemoveWorkspace(workspaceName))
-
+
throw new RepositoryException("Workspace " + workspaceName + " in use. If you want to "
+ " remove workspace close all open sessions");
@@ -647,6 +647,33 @@
}
/**
+ * Remove system workspace.
+ * Workspace become stopped, removed from container and removed from repository configuration.
+ *
+ * @throws RepositoryException - if workspace is in use, or can't be removed for other reason
+ */
+ protected void removeSystemWorkspace() throws RepositoryException
+ {
+
+ //check system workspace
+ String sysWSName = config.getSystemWorkspaceName();
+ if (repositoryContainer.getWorkspaceEntry(sysWSName) == null)
+ throw new NoSuchWorkspaceException("No system workspace " + sysWSName);
+
+ SessionRegistry sessionRegistry =
+ (SessionRegistry)repositoryContainer.getComponentInstance(SessionRegistry.class);
+
+ if (sessionRegistry != null && !sessionRegistry.isInUse(sysWSName))
+ {
+ throw new RepositoryException("Workspace " + sysWSName + " in use. If you want to "
+ + " remove workspace close all open sessions");
+ }
+
+ internalRemoveWorkspace(sysWSName);
+ config.getWorkspaceEntries().remove(repositoryContainer.getWorkspaceEntry(sysWSName));
+ }
+
+ /**
* {@inheritDoc}
*/
public WorkspaceContainerFacade getWorkspaceContainer(String workspaceName)
15 years, 8 months
exo-jcr SVN: r3094 - in kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src: main/java/org/exoplatform/services/cache/impl/jboss/ea and 5 other directories.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2010-09-08 12:34:20 -0400 (Wed, 08 Sep 2010)
New Revision: 3094
Added:
kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/AbstractExoCacheCreator.java
Modified:
kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/AbstractExoCache.java
kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ExoCacheFactoryImpl.java
kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ea/EAExoCacheCreator.java
kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/fifo/FIFOExoCacheCreator.java
kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/lfu/LFUExoCacheCreator.java
kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/lru/LRUExoCacheCreator.java
kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/mru/MRUExoCacheCreator.java
kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/test/java/org/exoplatform/services/cache/impl/jboss/TestAbstractExoCache.java
Log:
EXOJCR-943: Implementation based on the JBC Configuration, if 2 caches have the same config (appart the Eviction Policy), they will be converted into Regions of the same cache
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/AbstractExoCache.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/AbstractExoCache.java 2010-09-08 11:25:25 UTC (rev 3093)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/AbstractExoCache.java 2010-09-08 16:34:20 UTC (rev 3094)
@@ -78,17 +78,24 @@
private final CopyOnWriteArrayList<ListenerContext<K, V>> listeners;
protected final CacheSPI<K, V> cache;
+
+ protected final Fqn<String> rootFqn;
- public AbstractExoCache(ExoCacheConfig config, Cache<K, V> cache)
+ public AbstractExoCache(ExoCacheConfig config, Cache<K, V> cache, Fqn<String> rootFqn)
{
this.cache = (CacheSPI<K, V>)cache;
+ this.rootFqn = rootFqn;
this.listeners = new CopyOnWriteArrayList<ListenerContext<K, V>>();
setDistributed(config.isDistributed());
setLabel(config.getLabel());
setName(config.getName());
setLogEnabled(config.isLogEnabled());
setReplicated(config.isRepicated());
- cache.getConfiguration().setInvocationBatchingEnabled(true);
+ if (cache.getCacheStatus().createAllowed())
+ {
+ // Avoid set several times the same parameter if the cache is shared
+ cache.getConfiguration().setInvocationBatchingEnabled(true);
+ }
cache.addCacheListener(new CacheEventListener());
}
@@ -110,7 +117,7 @@
public void clearCache()
{
cache.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
- cache.removeNode(Fqn.ROOT);
+ cache.removeNode(rootFqn);
onClearCache();
}
@@ -158,7 +165,8 @@
*/
public int getCacheSize()
{
- return cache.getNumberOfNodes();
+ final NodeSPI<K, V> node = cache.peek(rootFqn, false);
+ return node == null ? 0 : node.getChildrenNamesDirect().size();
}
/**
@@ -167,7 +175,7 @@
public List<V> getCachedObjects()
{
final LinkedList<V> list = new LinkedList<V>();
- for (Node<K, V> node : cache.getRoot().getChildren())
+ for (Node<K, V> node : cache.getNode(rootFqn).getChildren())
{
if (node == null)
{
@@ -331,7 +339,7 @@
{
throw new IllegalArgumentException("No null selector");
}
- for (Node<K, V> node : cache.getRoot().getChildren())
+ for (Node<K, V> node : cache.getNode(rootFqn).getChildren())
{
if (node == null)
{
@@ -415,7 +423,7 @@
@SuppressWarnings("unchecked")
private K getKey(Fqn fqn)
{
- return (K)fqn.get(0);
+ return (K)fqn.get(rootFqn.size());
}
/**
@@ -423,7 +431,7 @@
*/
protected Fqn<Serializable> getFqn(Serializable name)
{
- return Fqn.fromElements(name);
+ return Fqn.fromRelativeElements(rootFqn, name);
}
void onExpire(K key, V obj)
@@ -521,13 +529,14 @@
}
@org.jboss.cache.notifications.annotation.CacheListener
+ @SuppressWarnings("unchecked")
public class CacheEventListener
{
@NodeEvicted
public void nodeEvicted(NodeEvictedEvent ne)
{
- if (ne.isPre())
+ if (ne.isPre() && ne.getFqn().isChildOf(rootFqn))
{
final NodeSPI<K, V> node = cache.peek(ne.getFqn(), true);
final K key = getKey(ne.getFqn());
@@ -535,11 +544,10 @@
}
}
- @SuppressWarnings("unchecked")
@NodeRemoved
public void nodeRemoved(NodeRemovedEvent ne)
{
- if (ne.isPre() && !ne.isOriginLocal())
+ if (ne.isPre() && !ne.isOriginLocal() && ne.getFqn().isChildOf(rootFqn))
{
final K key = getKey(ne.getFqn());
final Map<K, V> data = ne.getData();
@@ -547,11 +555,10 @@
}
}
- @SuppressWarnings("unchecked")
@NodeModified
public void nodeModified(NodeModifiedEvent ne)
{
- if (!ne.isOriginLocal() && !ne.isPre())
+ if (!ne.isOriginLocal() && !ne.isPre() && ne.getFqn().isChildOf(rootFqn))
{
final K key = getKey(ne.getFqn());
final Map<K, V> data = ne.getData();
Added: kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/AbstractExoCacheCreator.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/AbstractExoCacheCreator.java (rev 0)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/AbstractExoCacheCreator.java 2010-09-08 16:34:20 UTC (rev 3094)
@@ -0,0 +1,41 @@
+package org.exoplatform.services.cache.impl.jboss;
+
+import org.exoplatform.services.cache.ExoCacheConfig;
+import org.jboss.cache.Cache;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.Region;
+import org.jboss.cache.config.EvictionAlgorithmConfig;
+import org.jboss.cache.config.EvictionRegionConfig;
+
+import java.io.Serializable;
+
+/**
+ * This class is used to propose a set of common methods generally needed by {@link ExoCacheCreator}
+ * implementations
+ *
+ * @author <a href="mailto:nicolas.filotto@exoplatform.com">Nicolas Filotto</a>
+ * @version $Id$
+ *
+ */
+public abstract class AbstractExoCacheCreator implements ExoCacheCreator
+{
+
+ /**
+ * Create a new region to the given cache.
+ * @param config The ExoCacheConfig from which we get the name of the region.
+ * @param cache the cache instance to which we want to add the new region
+ * @param eac The Eviction Algorithm to use for the new region to create.
+ * @return The root Fqn of the new created region
+ */
+ protected Fqn<String> addEvictionRegion(ExoCacheConfig config, Cache<Serializable, Object> cache,
+ EvictionAlgorithmConfig eac)
+ {
+ Fqn<String> fqn = Fqn.fromElements(config.getName());
+ // Create the region
+ Region region = cache.getRegion(fqn, true);
+ // Set the eviction region config
+ region.setEvictionRegionConfig(new EvictionRegionConfig(fqn, eac));
+ return fqn;
+ }
+
+}
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ExoCacheFactoryImpl.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ExoCacheFactoryImpl.java 2010-09-08 11:25:25 UTC (rev 3093)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ExoCacheFactoryImpl.java 2010-09-08 16:34:20 UTC (rev 3094)
@@ -37,6 +37,7 @@
import org.jboss.cache.config.Configuration.CacheMode;
import java.io.Serializable;
+import java.net.URL;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
@@ -88,6 +89,12 @@
* The mapping between the cache names and the configuration paths
*/
private final Map<String, String> mappingCacheNameConfig = new HashMap<String, String>();
+
+ /**
+ * A Map that contains all the registered JBC instances.
+ */
+ private final Map<ConfigurationKey, Cache<Serializable, Object>> caches =
+ new HashMap<ConfigurationKey, Cache<Serializable, Object>>();
/**
* The default creator
@@ -96,14 +103,19 @@
public ExoCacheFactoryImpl(InitParams params, ConfigurationManager configManager)
{
+ this(getValueParam(params, CACHE_CONFIG_TEMPLATE_KEY), configManager);
+ }
+
+ ExoCacheFactoryImpl(String cacheConfigTemplate, ConfigurationManager configManager)
+ {
this.configManager = configManager;
- this.cacheConfigTemplate = getValueParam(params, CACHE_CONFIG_TEMPLATE_KEY);
+ this.cacheConfigTemplate = cacheConfigTemplate;
if (cacheConfigTemplate == null)
{
throw new RuntimeException("The parameter '" + CACHE_CONFIG_TEMPLATE_KEY + "' must be set");
}
}
-
+
/**
* To create a new cache instance according to the given configuration, we follow the steps below:
*
@@ -116,7 +128,7 @@
{
final String region = config.getName();
final String customConfig = mappingCacheNameConfig.get(region);
- final Cache<Serializable, Object> cache;
+ Cache<Serializable, Object> cache;
final CacheFactory<Serializable, Object> factory = new DefaultCacheFactory<Serializable, Object>();
final ExoCache<Serializable, Object> eXoCache;
try
@@ -143,6 +155,8 @@
cleanConfigurationTemplate(cache, region);
}
final ExoCacheCreator creator = getExoCacheCreator(config);
+ // Ensure that new created cache doesn't exist
+ cache = getUniqueInstance(cache, region);
// Create the cache
eXoCache = creator.create(config, cache);
// Create the cache
@@ -238,11 +252,102 @@
config.setEvictionConfig(evictionConfig);
}
evictionConfig.setEvictionRegionConfigs(new LinkedList<EvictionRegionConfig>());
- // Rename the cluster name
- String clusterName = config.getClusterName();
- if (clusterName != null && (clusterName = clusterName.trim()).length() > 0)
+ }
+
+ /**
+ * Try to find if a Cache of the same type (i.e. their {@link Configuration} are equals)
+ * has already been registered.
+ * If no cache has been registered, we register the given cache otherwise we
+ * use the previously registered cache.
+ * @param cache the cache to register
+ * @param region the region of the cache
+ * @return the given cache if has not been registered otherwise the cache of the same
+ * type that has already been registered
+ * @throws ExoCacheInitException
+ */
+ private synchronized Cache<Serializable, Object> getUniqueInstance(Cache<Serializable, Object> cache, String region)
+ throws ExoCacheInitException
+ {
+ Configuration cfg = cache.getConfiguration();
+ ConfigurationKey key;
+ try
{
- config.setClusterName(clusterName + " " + region);
+ key = new ConfigurationKey(cfg);
}
+ catch (CloneNotSupportedException e)
+ {
+ throw new ExoCacheInitException("Cannot clone the configuration.", e);
+ }
+ if (caches.containsKey(key))
+ {
+ cache = caches.get(key);
+ }
+ else
+ {
+ caches.put(key, cache);
+ if (LOG.isInfoEnabled())
+ LOG.info("A new eXo Cache based on JBoss Cache instance has been registered for the region " + region);
+ }
+ return cache;
}
+
+ /**
+ * This class is used to make {@link Configuration} being usable as a Key in an HashMap since
+ * some variables such as <code>jgroupsConfigFile</code> are not managed as expected in the
+ * methods equals and hashCode. Moreover two cache with same config except the EvictionConfig
+ * are considered as identical
+ */
+ private static class ConfigurationKey
+ {
+ private final URL jgroupsConfigFile;
+ private final Configuration conf;
+
+ public ConfigurationKey(Configuration initialConf) throws CloneNotSupportedException
+ {
+ // Clone it first since it will be modified
+ this.conf = initialConf.clone();
+ this.jgroupsConfigFile = conf.getJGroupsConfigFile();
+ // remove the jgroupsConfigFile from the conf
+ conf.setJgroupsConfigFile(null);
+ // remove the EvictionConfig to ignore it
+ conf.setEvictionConfig(null);
+ }
+
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((conf == null) ? 0 : conf.hashCode());
+ result = prime * result + ((jgroupsConfigFile == null) ? 0 : jgroupsConfigFile.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ ConfigurationKey other = (ConfigurationKey)obj;
+ if (conf == null)
+ {
+ if (other.conf != null)
+ return false;
+ }
+ else if (!conf.equals(other.conf))
+ return false;
+ if (jgroupsConfigFile == null)
+ {
+ if (other.jgroupsConfigFile != null)
+ return false;
+ }
+ else if (!jgroupsConfigFile.equals(other.jgroupsConfigFile))
+ return false;
+ return true;
+ }
+ }
}
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ea/EAExoCacheCreator.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ea/EAExoCacheCreator.java 2010-09-08 11:25:25 UTC (rev 3093)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ea/EAExoCacheCreator.java 2010-09-08 16:34:20 UTC (rev 3094)
@@ -23,12 +23,9 @@
import org.exoplatform.services.cache.ExoCacheConfig;
import org.exoplatform.services.cache.ExoCacheInitException;
import org.exoplatform.services.cache.impl.jboss.AbstractExoCache;
-import org.exoplatform.services.cache.impl.jboss.ExoCacheCreator;
+import org.exoplatform.services.cache.impl.jboss.AbstractExoCacheCreator;
import org.jboss.cache.Cache;
import org.jboss.cache.Fqn;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.config.EvictionConfig;
-import org.jboss.cache.config.EvictionRegionConfig;
import org.jboss.cache.eviction.ExpirationAlgorithm;
import org.jboss.cache.eviction.ExpirationAlgorithmConfig;
@@ -41,7 +38,7 @@
* nicolas.filotto(a)exoplatform.com
* 8 mars 2010
*/
-public class EAExoCacheCreator implements ExoCacheCreator
+public class EAExoCacheCreator extends AbstractExoCacheCreator
{
/**
@@ -95,18 +92,14 @@
private ExoCache<Serializable, Object> create(ExoCacheConfig config, Cache<Serializable, Object> cache,
int maxNodes, long minTimeToLive, long expirationTimeout) throws ExoCacheInitException
{
- final Configuration configuration = cache.getConfiguration();
final ExpirationAlgorithmConfig ea = new ExpirationAlgorithmConfig();
ea.setMaxNodes(maxNodes);
ea.setMinTimeToLive(minTimeToLive);
ea.setExpirationKeyName(ExpirationAlgorithmConfig.EXPIRATION_KEY);
- // Create an eviction region config
- final EvictionRegionConfig erc = new EvictionRegionConfig(Fqn.ROOT, ea);
- final EvictionConfig evictionConfig = configuration.getEvictionConfig();
- evictionConfig.setDefaultEvictionRegionConfig(erc);
+ Fqn<String> rooFqn = addEvictionRegion(config, cache, ea);
- return new EAExoCache(config, cache, ea, expirationTimeout);
+ return new EAExoCache(config, cache, rooFqn, ea, expirationTimeout);
}
/**
@@ -118,10 +111,10 @@
private final ExpirationAlgorithmConfig ea;
- public EAExoCache(ExoCacheConfig config, Cache<Serializable, Object> cache, ExpirationAlgorithmConfig ea,
- long expirationTimeout)
+ public EAExoCache(ExoCacheConfig config, Cache<Serializable, Object> cache, Fqn<String> rooFqn,
+ ExpirationAlgorithmConfig ea, long expirationTimeout)
{
- super(config, cache);
+ super(config, cache, rooFqn);
this.ea = ea;
this.expirationTimeout = expirationTimeout;
}
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/fifo/FIFOExoCacheCreator.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/fifo/FIFOExoCacheCreator.java 2010-09-08 11:25:25 UTC (rev 3093)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/fifo/FIFOExoCacheCreator.java 2010-09-08 16:34:20 UTC (rev 3094)
@@ -24,12 +24,9 @@
import org.exoplatform.services.cache.ExoCacheConfig;
import org.exoplatform.services.cache.ExoCacheInitException;
import org.exoplatform.services.cache.impl.jboss.AbstractExoCache;
-import org.exoplatform.services.cache.impl.jboss.ExoCacheCreator;
+import org.exoplatform.services.cache.impl.jboss.AbstractExoCacheCreator;
import org.jboss.cache.Cache;
import org.jboss.cache.Fqn;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.config.EvictionConfig;
-import org.jboss.cache.config.EvictionRegionConfig;
import org.jboss.cache.eviction.FIFOAlgorithmConfig;
import java.io.Serializable;
@@ -41,7 +38,7 @@
* exo(a)exoplatform.com
* 20 juil. 2009
*/
-public class FIFOExoCacheCreator implements ExoCacheCreator
+public class FIFOExoCacheCreator extends AbstractExoCacheCreator
{
/**
@@ -88,16 +85,10 @@
private ExoCache<Serializable, Object> create(ExoCacheConfig config, Cache<Serializable, Object> cache, int maxNodes, long minTimeToLive)
throws ExoCacheInitException
{
- final Configuration configuration = cache.getConfiguration();
final FIFOAlgorithmConfig fifo = new FIFOAlgorithmConfig(maxNodes);
fifo.setMinTimeToLive(minTimeToLive);
- // Create an eviction region config
- final EvictionRegionConfig erc = new EvictionRegionConfig(Fqn.ROOT, fifo);
-
- final EvictionConfig evictionConfig = configuration.getEvictionConfig();
- evictionConfig.setDefaultEvictionRegionConfig(erc);
-
- return new AbstractExoCache<Serializable, Object>(config, cache)
+ Fqn<String> rooFqn = addEvictionRegion(config, cache, fifo);
+ return new AbstractExoCache<Serializable, Object>(config, cache, rooFqn)
{
public void setMaxSize(int max)
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/lfu/LFUExoCacheCreator.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/lfu/LFUExoCacheCreator.java 2010-09-08 11:25:25 UTC (rev 3093)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/lfu/LFUExoCacheCreator.java 2010-09-08 16:34:20 UTC (rev 3094)
@@ -25,12 +25,9 @@
import org.exoplatform.services.cache.ExoCacheConfig;
import org.exoplatform.services.cache.ExoCacheInitException;
import org.exoplatform.services.cache.impl.jboss.AbstractExoCache;
-import org.exoplatform.services.cache.impl.jboss.ExoCacheCreator;
+import org.exoplatform.services.cache.impl.jboss.AbstractExoCacheCreator;
import org.jboss.cache.Cache;
import org.jboss.cache.Fqn;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.config.EvictionConfig;
-import org.jboss.cache.config.EvictionRegionConfig;
import org.jboss.cache.eviction.LFUAlgorithmConfig;
import java.io.Serializable;
@@ -42,7 +39,7 @@
* exo(a)exoplatform.com
* 21 juil. 2009
*/
-public class LFUExoCacheCreator implements ExoCacheCreator
+public class LFUExoCacheCreator extends AbstractExoCacheCreator
{
/**
@@ -58,7 +55,8 @@
/**
* {@inheritDoc}
*/
- public ExoCache<Serializable, Object> create(ExoCacheConfig config, Cache<Serializable, Object> cache) throws ExoCacheInitException
+ public ExoCache<Serializable, Object> create(ExoCacheConfig config, Cache<Serializable, Object> cache)
+ throws ExoCacheInitException
{
if (config instanceof LFUExoCacheConfig)
{
@@ -75,18 +73,13 @@
/**
* Creates a new ExoCache instance with the relevant parameters
*/
- private ExoCache<Serializable, Object> create(ExoCacheConfig config, Cache<Serializable, Object> cache, int maxNodes, int minNodes,
- long minTimeToLive) throws ExoCacheInitException
+ private ExoCache<Serializable, Object> create(ExoCacheConfig config, Cache<Serializable, Object> cache,
+ int maxNodes, int minNodes, long minTimeToLive) throws ExoCacheInitException
{
- final Configuration configuration = cache.getConfiguration();
final LFUAlgorithmConfig lfu = new LFUAlgorithmConfig(maxNodes, minNodes);
lfu.setMinTimeToLive(minTimeToLive);
- // Create an eviction region config
- final EvictionRegionConfig erc = new EvictionRegionConfig(Fqn.ROOT, lfu);
-
- final EvictionConfig evictionConfig = configuration.getEvictionConfig();
- evictionConfig.setDefaultEvictionRegionConfig(erc);
- return new LFUExoCache(config, cache, lfu);
+ Fqn<String> rooFqn = addEvictionRegion(config, cache, lfu);
+ return new LFUExoCache(config, cache, rooFqn, lfu);
}
/**
@@ -113,9 +106,10 @@
private final LFUAlgorithmConfig lfu;
- public LFUExoCache(ExoCacheConfig config, Cache<Serializable, Object> cache, LFUAlgorithmConfig lfu)
+ public LFUExoCache(ExoCacheConfig config, Cache<Serializable, Object> cache, Fqn<String> rooFqn,
+ LFUAlgorithmConfig lfu)
{
- super(config, cache);
+ super(config, cache, rooFqn);
this.lfu = lfu;
}
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/lru/LRUExoCacheCreator.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/lru/LRUExoCacheCreator.java 2010-09-08 11:25:25 UTC (rev 3093)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/lru/LRUExoCacheCreator.java 2010-09-08 16:34:20 UTC (rev 3094)
@@ -25,12 +25,9 @@
import org.exoplatform.services.cache.ExoCacheConfig;
import org.exoplatform.services.cache.ExoCacheInitException;
import org.exoplatform.services.cache.impl.jboss.AbstractExoCache;
-import org.exoplatform.services.cache.impl.jboss.ExoCacheCreator;
+import org.exoplatform.services.cache.impl.jboss.AbstractExoCacheCreator;
import org.jboss.cache.Cache;
import org.jboss.cache.Fqn;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.config.EvictionConfig;
-import org.jboss.cache.config.EvictionRegionConfig;
import org.jboss.cache.eviction.LRUAlgorithmConfig;
import java.io.Serializable;
@@ -42,7 +39,7 @@
* exo(a)exoplatform.com
* 21 juil. 2009
*/
-public class LRUExoCacheCreator implements ExoCacheCreator
+public class LRUExoCacheCreator extends AbstractExoCacheCreator
{
/**
@@ -63,7 +60,8 @@
/**
* {@inheritDoc}
*/
- public ExoCache<Serializable, Object> create(ExoCacheConfig config, Cache<Serializable, Object> cache) throws ExoCacheInitException
+ public ExoCache<Serializable, Object> create(ExoCacheConfig config, Cache<Serializable, Object> cache)
+ throws ExoCacheInitException
{
if (config instanceof LRUExoCacheConfig)
{
@@ -82,18 +80,13 @@
/**
* Creates a new ExoCache instance with the relevant parameters
*/
- private ExoCache<Serializable, Object> create(ExoCacheConfig config, Cache<Serializable, Object> cache, int maxNodes, long timeToLive,
- long maxAge, long minTimeToLive) throws ExoCacheInitException
+ private ExoCache<Serializable, Object> create(ExoCacheConfig config, Cache<Serializable, Object> cache,
+ int maxNodes, long timeToLive, long maxAge, long minTimeToLive) throws ExoCacheInitException
{
- final Configuration configuration = cache.getConfiguration();
final LRUAlgorithmConfig lru = new LRUAlgorithmConfig(timeToLive, maxAge, maxNodes);
lru.setMinTimeToLive(minTimeToLive);
- // Create an eviction region config
- final EvictionRegionConfig erc = new EvictionRegionConfig(Fqn.ROOT, lru);
-
- final EvictionConfig evictionConfig = configuration.getEvictionConfig();
- evictionConfig.setDefaultEvictionRegionConfig(erc);
- return new LRUExoCache(config, cache, lru);
+ Fqn<String> rooFqn = addEvictionRegion(config, cache, lru);
+ return new LRUExoCache(config, cache, rooFqn, lru);
}
/**
@@ -120,9 +113,10 @@
private final LRUAlgorithmConfig lru;
- public LRUExoCache(ExoCacheConfig config, Cache<Serializable, Object> cache, LRUAlgorithmConfig lru)
+ public LRUExoCache(ExoCacheConfig config, Cache<Serializable, Object> cache, Fqn<String> rooFqn,
+ LRUAlgorithmConfig lru)
{
- super(config, cache);
+ super(config, cache, rooFqn);
this.lru = lru;
}
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/mru/MRUExoCacheCreator.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/mru/MRUExoCacheCreator.java 2010-09-08 11:25:25 UTC (rev 3093)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/mru/MRUExoCacheCreator.java 2010-09-08 16:34:20 UTC (rev 3094)
@@ -24,12 +24,9 @@
import org.exoplatform.services.cache.ExoCacheConfig;
import org.exoplatform.services.cache.ExoCacheInitException;
import org.exoplatform.services.cache.impl.jboss.AbstractExoCache;
-import org.exoplatform.services.cache.impl.jboss.ExoCacheCreator;
+import org.exoplatform.services.cache.impl.jboss.AbstractExoCacheCreator;
import org.jboss.cache.Cache;
import org.jboss.cache.Fqn;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.config.EvictionConfig;
-import org.jboss.cache.config.EvictionRegionConfig;
import org.jboss.cache.eviction.MRUAlgorithmConfig;
import java.io.Serializable;
@@ -41,7 +38,7 @@
* exo(a)exoplatform.com
* 21 juil. 2009
*/
-public class MRUExoCacheCreator implements ExoCacheCreator
+public class MRUExoCacheCreator extends AbstractExoCacheCreator
{
/**
@@ -72,16 +69,10 @@
private ExoCache<Serializable, Object> create(ExoCacheConfig config, Cache<Serializable, Object> cache, int maxNodes, long minTimeToLive)
throws ExoCacheInitException
{
- final Configuration configuration = cache.getConfiguration();
final MRUAlgorithmConfig mru = new MRUAlgorithmConfig(maxNodes);
mru.setMinTimeToLive(minTimeToLive);
- // Create an eviction region config
- final EvictionRegionConfig erc = new EvictionRegionConfig(Fqn.ROOT, mru);
-
- final EvictionConfig evictionConfig = configuration.getEvictionConfig();
- evictionConfig.setDefaultEvictionRegionConfig(erc);
-
- return new AbstractExoCache<Serializable, Object>(config, cache)
+ Fqn<String> rooFqn = addEvictionRegion(config, cache, mru);
+ return new AbstractExoCache<Serializable, Object>(config, cache, rooFqn)
{
public void setMaxSize(int max)
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/test/java/org/exoplatform/services/cache/impl/jboss/TestAbstractExoCache.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/test/java/org/exoplatform/services/cache/impl/jboss/TestAbstractExoCache.java 2010-09-08 11:25:25 UTC (rev 3093)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/test/java/org/exoplatform/services/cache/impl/jboss/TestAbstractExoCache.java 2010-09-08 16:34:20 UTC (rev 3094)
@@ -19,6 +19,9 @@
package org.exoplatform.services.cache.impl.jboss;
import org.exoplatform.container.PortalContainer;
+import org.exoplatform.container.configuration.ConfigurationManager;
+import org.exoplatform.container.xml.InitParams;
+import org.exoplatform.container.xml.ObjectParameter;
import org.exoplatform.services.cache.CacheListener;
import org.exoplatform.services.cache.CacheListenerContext;
import org.exoplatform.services.cache.CacheService;
@@ -26,7 +29,9 @@
import org.exoplatform.services.cache.ExoCache;
import org.exoplatform.services.cache.ExoCacheConfig;
import org.exoplatform.services.cache.ExoCacheFactory;
+import org.exoplatform.services.cache.ExoCacheInitException;
import org.exoplatform.services.cache.ObjectCacheInfo;
+import org.exoplatform.services.cache.impl.jboss.lru.LRUExoCacheCreator;
import org.exoplatform.test.BasicTestCase;
import java.io.Serializable;
@@ -200,7 +205,8 @@
CachedObjectSelector<Serializable, Object> selector = new CachedObjectSelector<Serializable, Object>()
{
- public void onSelect(ExoCache<? extends Serializable, ? extends Object> cache, Serializable key, ObjectCacheInfo<? extends Object> ocinfo) throws Exception
+ public void onSelect(ExoCache<? extends Serializable, ? extends Object> cache, Serializable key,
+ ObjectCacheInfo<? extends Object> ocinfo) throws Exception
{
assertTrue(key.equals(new MyKey("a")) || key.equals(new MyKey("b")) || key.equals(new MyKey("c")));
assertTrue(ocinfo.get().equals(1) || ocinfo.get().equals(2) || ocinfo.get().equals(3));
@@ -229,10 +235,27 @@
assertEquals(2, cache.getCacheMiss() - misses);
}
+ private ExoCacheFactory getExoCacheFactoryInstance() throws ExoCacheInitException
+ {
+ PortalContainer pc = PortalContainer.getInstance();
+ ExoCacheFactoryImpl factory = new ExoCacheFactoryImpl("jar:/conf/portal/cache-configuration-template.xml", (ConfigurationManager)pc
+ .getComponentInstanceOfType(ConfigurationManager.class));
+ InitParams params = new InitParams();
+ ObjectParameter param = new ObjectParameter();
+ param.setName("LRU");
+ param.setObject(new LRUExoCacheCreator());
+ params.addParam(param);
+ ExoCacheCreatorPlugin plugin = new ExoCacheCreatorPlugin(params);
+ factory.addCreator(plugin);
+ return factory;
+ }
+
@SuppressWarnings("unchecked")
public void testDistributedCache() throws Exception
{
- System.out.println("WARNING: For Linux distributions the following JVM parameter must be set to true, java.net.preferIPv4Stack = " + System.getProperty("java.net.preferIPv4Stack"));
+ System.out
+ .println("WARNING: For Linux distributions the following JVM parameter must be set to true, java.net.preferIPv4Stack = "
+ + System.getProperty("java.net.preferIPv4Stack"));
ExoCacheConfig config = new ExoCacheConfig();
config.setName("MyCacheDistributed");
config.setMaxSize(5);
@@ -245,13 +268,16 @@
config2.setLiveTime(1);
config2.setImplementation("LRU");
config2.setDistributed(true);
- AbstractExoCache<Serializable, Object> cache1 = (AbstractExoCache<Serializable, Object>)factory.createCache(config);
+ AbstractExoCache<Serializable, Object> cache1 =
+ (AbstractExoCache<Serializable, Object>)getExoCacheFactoryInstance().createCache(config);
MyCacheListener listener1 = new MyCacheListener();
cache1.addCacheListener(listener1);
- AbstractExoCache<Serializable, Object> cache2 = (AbstractExoCache<Serializable, Object>)factory.createCache(config);
+ AbstractExoCache<Serializable, Object> cache2 =
+ (AbstractExoCache<Serializable, Object>)getExoCacheFactoryInstance().createCache(config);
MyCacheListener listener2 = new MyCacheListener();
cache2.addCacheListener(listener2);
- AbstractExoCache<Serializable, Object> cache3 = (AbstractExoCache<Serializable, Object>)factory.createCache(config2);
+ AbstractExoCache<Serializable, Object> cache3 =
+ (AbstractExoCache<Serializable, Object>)getExoCacheFactoryInstance().createCache(config2);
MyCacheListener listener3 = new MyCacheListener();
cache3.addCacheListener(listener3);
try
@@ -314,7 +340,7 @@
cache1.put(new MyKey("c"), "c");
cache1.clearCache();
assertEquals(0, cache1.getCacheSize());
- assertEquals(null, cache1.get(new MyKey("b")));
+ assertEquals(null, cache1.get(new MyKey("b")));
assertEquals("c", cache2.get(new MyKey("b")));
assertEquals("c", cache2.get(new MyKey("c")));
assertEquals(2, cache2.getCacheSize());
@@ -684,6 +710,7 @@
public static class MyKey implements Serializable
{
private static final long serialVersionUID = 1L;
+
public String value;
public MyKey(String value)
15 years, 8 months
exo-jcr SVN: r3093 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/jbosscache.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2010-09-08 07:25:25 -0400 (Wed, 08 Sep 2010)
New Revision: 3093
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/jbosscache/ExoJBossCacheFactory.java
Log:
EXOJCR-942: Javadoc improved
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/jbosscache/ExoJBossCacheFactory.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/jbosscache/ExoJBossCacheFactory.java 2010-09-08 10:07:26 UTC (rev 3092)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/jbosscache/ExoJBossCacheFactory.java 2010-09-08 11:25:25 UTC (rev 3093)
@@ -234,12 +234,13 @@
* Try to find if a Cache of the same type (i.e. their {@link Configuration} are equals)
* has already been registered for the same current container and the same {@link CacheType}.
* If no cache has been registered, we register the given cache otherwise we
- * use the previously registered cache and we create a dedicated region to the shared cache
+ * use the previously registered cache and we create a dedicated region into the shared cache
* for the given cache.
* @param cacheType The type of the target cache
- * @param rootFqn the rootFq
+ * @param rootFqn the rootFqn corresponding to root of the region
* @param cache the cache to register
- * @return the unique instance of the same cache registered
+ * @return the given cache if has not been registered otherwise the cache of the same
+ * type that has already been registered
* @throws RepositoryConfigurationException
*/
@SuppressWarnings("unchecked")
@@ -277,7 +278,7 @@
{
caches.put(key, cache);
if (log.isInfoEnabled())
- log.info("A new JBoss Cache instance has been registered fot the region " + rootFqn + ", a cache of type " + cacheType
+ log.info("A new JBoss Cache instance has been registered for the region " + rootFqn + ", a cache of type " + cacheType
+ " and the container " + container.getContext().getName());
}
addEvictionRegion(rootFqn, cache, cfg);
15 years, 8 months
exo-jcr SVN: r3092 - jcr/tags/1.12.4-GA.
by do-not-reply@jboss.org
Author: tolusha
Date: 2010-09-08 06:07:26 -0400 (Wed, 08 Sep 2010)
New Revision: 3092
Added:
jcr/tags/1.12.4-GA/readme.txt
Log:
EXOJCR-911: add release notes
Added: jcr/tags/1.12.4-GA/readme.txt
===================================================================
--- jcr/tags/1.12.4-GA/readme.txt (rev 0)
+++ jcr/tags/1.12.4-GA/readme.txt 2010-09-08 10:07:26 UTC (rev 3092)
@@ -0,0 +1,362 @@
+JCR 1.12.4-GA release notes
+===========================
+
+eXoPlatform Java Content Repository (JSR-170) implementation and Extension services with clustering support.
+
+Features of this version:
+- Moving file(s) between workspaces through FTP
+- Support MS Office 2007 content and meta data extraction
+- Support "dav:isreadonly" property to control behavior of Microsoft Webfolders extension
+- Decouple event name from listener name in ListenerService
+
+Changes of 1.12.4-GA
+=====================
+
+Bug
+ * [EXOJCR-688] - Some entries in the eXo JCR cache are not evicted properly
+ * [EXOJCR-843] - Exceptions after importing file with version history
+ * [EXOJCR-849] - "Permission denied" on client side, when trying to move file(s) to another workspace through FTP
+ * [EXOJCR-856] - Problems while recopying same files via webdav
+ * [EXOJCR-865] - Data corrupt after restore a node which has been imported with version history
+ * [EXOJCR-878] - WebDAV doesn't work with nt:file
+ * [EXOJCR-879] - TestCaching.testNotModifiedSince failed in same cases
+ * [EXOJCR-888] - The problems with restore version node
+ * [EXOJCR-890] - JSON framework don't work with beans created in groovy
+ * [EXOJCR-891] - Snaphosts IDs make the applications build improperly
+ * [EXOJCR-908] - Used wrong delimiter during parsing permission value
+ * [EXOJCR-909] - In LDAPService, InitialContext is not safely closed in authenticate method
+ * [EXOJCR-912] - Unable to convert the JCR documentation to pdf
+ * [EXOJCR-916] - Duplicate instantiation of some services
+ * [EXOJCR-921] - Workspace.copy(srcWS, srcAbsPath, destAbsPath) can not copy root child to another workspace root child
+ * [EXOJCR-924] - Unable to coerce 'Event' into a LONG: java.lang.NumberFormatException: For input string: "Event"
+ * [EXOJCR-933] - Determine property type from nodetype definition in DocumentViewImport for version history.
+ * [EXOJCR-936] - Avoid converting binary value to String in tests
+
+Feature Request
+ * [EXOJCR-842] - Allow to disable a given PortalContainer
+ * [EXOJCR-880] - Determine property is multi or single value from nodetype definition in import.
+ * [EXOJCR-886] - Update the document handler to manage MS Office 2007 meta data extraction (docx, ...)
+ * [EXOJCR-934] - Decouple event name from listener name in ListenerService.
+ * [EXOJCR-935] - Add "dav:isreadonly" property management
+
+Task
+ * [EXOJCR-896] - Port Manageability article into docbook
+ * [EXOJCR-905] - Merge the reference guide and the user guide in one single guide
+ * [EXOJCR-913] - Abuse of INFO level logging for DocNumberCache.get()
+ * [EXOJCR-914] - excessive INFO logging by IndexMerger.run()
+ * [EXOJCR-915] - excessive INFO logging by IndexMerger.run()
+ * [EXOJCR-917] - core.packaging.module.js error when in deploy phase
+ * [EXOJCR-919] - maxVolatileTime should be checked on checkFlush()
+ * [EXOJCR-927] - Add "application/x-groovy+html" to HTMLDocumentReader and "application/x-jaxrs+groovy" to TextPlainDocumentReader
+ * [EXOJCR-892] - Remove Fake Chapters
+
+Changes of 1.12.3-GA
+=====================
+
+Bug
+ * [EXOJCR-754] - JDBC Statements left open : Use of Datasources instead of DBCP and C3P0 pools
+ * [EXOJCR-763] - Reordering samename sibling nodes does not update path of child nodes
+ * [EXOJCR-766] - QPath isDescendantOf returns wrong result on samename siblings
+ * [EXOJCR-774] - If-Modified-Since doesn't seem to be well managed in the Wevdav
+ * [EXOJCR-781] - LockManagerImpl should call InitialContextInitializer.recall
+ * [EXOJCR-784] - DOC : wrong examples in profiles section
+ * [EXOJCR-785] - Parameter maxVolatileTime is not working correctly
+ * [EXOJCR-788] - Inconsistency issue cans occur on default portal container parameters
+ * [EXOJCR-795] - Unexpected behavior of the method PortalContainer.isScopeValid()
+ * [EXOJCR-796] - Data corruption
+ * [EXOJCR-804] - "No such file or directory" exception for value storage when using MySQL or Postgres DB in WCM demo 2.0
+ * [EXOJCR-806] - Problems while copying "ftp-ftp"
+ * [EXOJCR-810] - TestRemoveFromValueStorage failed in configuration without ValueStorage
+ * [EXOJCR-813] - ItemImpl.getParent method must return session pooled parent
+ * [EXOJCR-817] - max-buffer-size from configuration should be use to TransientValueData in import (docview and sysview)
+ * [EXOJCR-835] - TestMultiDbJDBCConnection and TestSingleDbJDBCConnection must drop also JCR_xCONTAINER table on tearDown
+ * [EXOJCR-857] - Exception during PROPFIND request if some property content "%" and after not hex chracters
+ * [EXOJCR-865] - Data corrupt after restore a node which has been imported with version history
+ * [EXOJCR-882] - TestCaching fails on Windows XP SP 2 with Russian locale
+
+Feature Request
+ * [EXOJCR-230] - Refactore and move in main part of exo.ws.rest.core project class AbstractResourceTest
+ * [EXOJCR-782] - No longer force extension developers to redefine the whole dependencies list
+ * [EXOJCR-783] - Use cached table for HSLQLDB tables
+ * [EXOJCR-797] - Unable see error message from ProxyService if remote server does not provide Content-Type header.
+
+Task
+ * [EXOJCR-392] - Siblings reordering may update not all the child-items in cache
+ * [EXOJCR-751] - Prepare maintenance branch for jcr 1.12
+ * [EXOJCR-808] - For Sybase DB "check-sns-new-connection" should be set to false by default
+ * [EXOJCR-809] - OrganizationService's tests should not be excluded
+ * [EXOJCR-815] - Document how to use AS Managed DataSource
+ * [EXOJCR-867] - Port documentation for Kernel from wiki to docbook
+ * [EXOJCR-868] - Port documentation for Core from wiki to docbook
+ * [EXOJCR-869] - Port documentation for JCR from wiki to docbook
+ * [EXOJCR-870] - Cleanup WS documentation
+ * [EXOJCR-871] - Document RestServicesList service
+ * [EXOJCR-881] - Port functionality of EXOJCR-482 in jcr-1.12.x
+ * [EXOJCR-884] - Rename JCR documentation artifacts to exo.jcr.* form
+
+Changes of 1.12.2-GA
+====================
+
+Bug
+ * [EXOJCR-497] - JCR serialization test wrong logic with CASable storage
+ * [EXOJCR-730] - Restored repository not accessible after restart Tomcat
+ * [EXOJCR-731] - Deploy error (500 - Unexpected error. null) of REST Service with annotation inheritance.
+ * [EXOJCR-735] - JCR repositories created in runtime is not available after eXo Social restart
+ * [EXOJCR-736] - Problems with anonymous entrance on FTP and NPE
+ * [EXOJCR-743] - InitialContextBinder bind twice same datasource in some case
+ * [EXOJCR-762] - Check whether the repository with the given name doesn't exists before starting restore from backup
+
+Feature Request
+ * [EXOJCR-640] - Migrate to newer version of Apache PDFBox ( and FontBox ) if possible;
+
+Task
+ * [EXOJCR-596] - Upload eXoJCR documentation on jboss.org
+ * [EXOJCR-668] - Validate format of the default values of the property definition during the nodetype registration
+ * [EXOJCR-738] - Search does not work with source in CDATA tag in XML document
+ * [EXOJCR-740] - Constrains ranges are not used in NodeTypeImpl.canSetProperty() validation
+ * [EXOJCR-741] - Backupconsole build improvements
+ * [EXOJCR-765] - Use StringBuilder instead of String concatenation in MSExcelDocumentReader.getContentAsText
+ * [EXOJCR-681] - Decreasing perfomance while running WebdavReadWriteTest tests several times in row
+
+
+
+Changes of 1.12.2-CR1
+=====================
+
+Bug
+ * [EXOJCR-175] - Problems with HTTPBackupAgent - Cyrillic symbols aren't showing after restore
+ * [EXOJCR-683] - java.io.IOException: Socket read failed on heavy loaded WebdavAddBLOBTest benchmark test
+ * [EXOJCR-697] - SQL search by date doesn't work
+ * [EXOJCR-698] - URL encoding in SEARCH and PROPFIND responces differs.
+ * [EXOJCR-700] - Problem in user search with MySql and PostgresDB
+ * [EXOJCR-704] - JCR testuite hangs on sybase
+ * [EXOJCR-708] - Problem with full text searching in text files with non-latin content.
+ * [EXOJCR-712] - Concurrent service creation leads to duplicate service instantiation
+ * [EXOJCR-724] - Bad URL in the error message when a component cannot be instantiated
+ * [EXOJCR-726] - Improper conversion of jboss.server.config.url system property value into File (spaces in filename problem)
+ * [EXOJCR-729] - The FileNotFoundException in restore workspace over BackupWorkspaceinitializer
+ * [EXOJCR-734] - The binary values was not stored in incremental backup.
+
+Feature Request
+ * [EXOJCR-705] - Expose listeners in OrganizationService
+ * [EXOJCR-707] - Check repository management operations on thread safety
+ * [EXOJCR-718] - Allow to get the complete configuration at runtime
+ * [EXOJCR-719] - Better debugging of components loaded
+ * [EXOJCR-721] - Add possibility to use customized GroovyClassLoader in org.exoplatform.services.script.groovy.GroovyScriptInstantiator
+ * [EXOJCR-722] - Make it possible to use other then org.exoplatform.services.rest.impl.method.DefaultMethodInvoker
+
+Task
+ * [EXOJCR-354] - Invoke post read after permissions check
+ * [EXOJCR-663] - Make possibility extends classes RequestDispatcher and ResourceBinder.
+ * [EXOJCR-691] - Fix your missing dependencies
+ * [EXOJCR-692] - Find the reason why the method of type Node.hasNodes is much slower since beta5
+ * [EXOJCR-694] - Change JBC dependencies to use 3.2.4.GA
+ * [EXOJCR-696] - Reduce the concurrency Level in the JBoss Cache Config
+ * [EXOJCR-711] - Misleading error message appears when the external settings cannot be found
+ * [EXOJCR-714] - Improve the usability of the ContainerLifecyclePlugin
+ * [EXOJCR-715] - Ensure that the ExoContainer is fully ThreadSafe
+ * [EXOJCR-716] - Prevent the JobSchedulerServiceImpl to launch jobs that rely on non started services
+ * [EXOJCR-717] - Add to RestRegistryService method without repositoryName in PathParam, insted use current repository. Methods with repositoryName in PathParam marks as Deprecated.
+ * [EXOJCR-720] - Make possibility extends classe GroovyScript2RestLoader
+ * [EXOJCR-723] - JCR Statistics: Describe the arguments of the methods exposed through JMX
+ * [EXOJCR-728] - implementing RequestLifecycle for REST services
+
+
+Changes of 1.12.1-GA
+=====================
+
+Bug
+ * [EXOJCR-612] - JBoss Cache Implementation for the Cache Service test TestAbstractExoCache fails
+ * [EXOJCR-638] - get mixin types through the NodeTypeUtil class
+ * [EXOJCR-661] - Cannot access to the MBeans through the JConsole in Standalone mode
+ * [EXOJCR-662] - Processing SQLException may cause infinite loop.
+ * [EXOJCR-664] - org.exoplatform.services.jcr.impl.storage.value.fs.TestFileIOChannel.testConcurrentRead fail with MSSQL and DB2
+ * [EXOJCR-667] - Temporary spooled file can be not found on save
+ * [EXOJCR-671] - ConcurrentModificationException in FileCleaner with heavy load
+ * [EXOJCR-672] - An eXoCache clear should be local
+ * [EXOJCR-687] - Some JCR parameters that are time parameter are retrieved as number instead of time
+
+Feature Request
+ * [EXOJCR-498] - Provide more details when a JCR query is invalid
+ * [EXOJCR-634] - Upload of a file with special characters like " ' " in filename is not supported by the FTPservice
+ * [EXOJCR-645] - Add ExtHttpHeaders.JAXRS_BODY_PROVIDED header for unhandled exception in REST services and set error message to body responce
+
+Task
+ * [EXOJCR-578] - Use Fisheye in SCM urls used in maven
+ * [EXOJCR-611] - Provide a way to collect statistics around the JCR API accesses
+ * [EXOJCR-639] - Find the reason why the methods of type Property.setValue are much slower since beta5
+ * [EXOJCR-685] - Change JBC dependencies to use 3.2.3.GA
+ * [EXOJCR-689] - Standartize eXo JCR docnmentation projects description.
+ * [EXOJCR-690] - Apply changes in the eXo JCR project in order to be able to publish artifacts in the nexus of JBoss
+ * [EXOJCR-545] - Checking performance on SearchNodesByPropertyTest
+ * [EXOJCR-643] - Improve the performances of the lucene indexing in a cluster by removing contention for read operations
+
+
+Changes of 1.12.1-CR1
+=====================
+
+Bug
+ * [EXOJCR-256] - There are server errors "500 Internal Server Error:" during creation repository or workspace by RestRepositoryService
+ * [EXOJCR-348] - Test problem: TestCleanableFileStreamValueData failed
+ * [EXOJCR-519] - DAILY TESTS are going too long (avg time=5hours)
+ * [EXOJCR-531] - Problems with Lock operations
+ * [EXOJCR-546] - TESTING: Performance testing problems. LockUnlockOwnNodeTest - TPS fell down
+ * [EXOJCR-548] - problem with import & export node
+ * [EXOJCR-555] - NPE with cache eviction at startup
+ * [EXOJCR-557] - Problem while uploading *.pdf to WebDAV server using Mac OS Finder
+ * [EXOJCR-558] - Files uploaded by Mac OS finder are displayed with size "0"
+ * [EXOJCR-559] - Problems with daily performance testing - on PostgreSQL 8.2.9
+ * [EXOJCR-567] - The REST servlet dump errors when the client cut the socket too early should be only a debug log
+ * [EXOJCR-572] - Can not create workspace with default configuration of lock manager
+ * [EXOJCR-581] - Listing the directory in TreeFile may return null during race condition, causing NPE.
+ * [EXOJCR-584] - User's research is case sensitive
+ * [EXOJCR-586] - Missed slf4j dependency for jcr applications on tomcat AS
+ * [EXOJCR-587] - session.save() throws NPE after node reordering
+ * [EXOJCR-588] - Tests errors in eXo XML Processing Services on MACOS
+ * [EXOJCR-591] - Problem with ObservationManager
+ * [EXOJCR-599] - deadlock during dashboard editing
+ * [EXOJCR-600] - Concurrency problem (java.util.HashMap.put called from CacheableLockManagerImpl.getSessionLockManager(CacheableLockManagerImpl.java:473))
+ * [EXOJCR-601] - gatein sample extension should not be required
+ * [EXOJCR-602] - StackOverflow on JsonGeneratorImpl
+ * [EXOJCR-603] - impossible to change user password
+ * [EXOJCR-607] - Sybase Issue with GateIn
+ * [EXOJCR-608] - XaSessionImpl as XA resource should be unique per user, workspace and repository
+ * [EXOJCR-614] - Node.getReferences fail in some cases
+ * [EXOJCR-615] - Need check nodedata to avoid exception in method NodeImpl.isNodeType(String).
+ * [EXOJCR-619] - Log record forging (Security Issue)
+ * [EXOJCR-621] - Conflict between symlink feature and Jbosscache
+ * [EXOJCR-623] - Unable to get a version of document using WebDAV (HTTP Response 404 returned).
+ * [EXOJCR-633] - Problems with manual testing - tomcat-server on ftp -.IndexOutOfBoundsException
+
+Feature Request
+ * [EXOJCR-549] - Backup and Restore of a whole Repository
+ * [EXOJCR-571] - Change PersitedValueDataReader/Writer
+ * [EXOJCR-573] - Create database and bind DataSource in runtime
+ * [EXOJCR-582] - DB script modification for oracle11 compatibility
+ * [EXOJCR-585] - Allow to get statistics on Database Access without using a Profiler
+ * [EXOJCR-616] - Remove repository container from repositoryContainers map when repository container start fail.
+ * [EXOJCR-617] - Map environment parameters for all String fields in Repository configuration
+
+Task
+ * [EXOJCR-150] - Ftp client tests failute
+ * [EXOJCR-250] - Add human readable message in case Workspace creation error via HTTPBackupAgent
+ * [EXOJCR-393] - Create indexer load test
+ * [EXOJCR-523] - Upgrade to JBoss Cache 3.2.3.GA
+ * [EXOJCR-550] - Bind slf4j-log4j and log4j dependencies onto the test phase of the various modules of JCR
+ * [EXOJCR-552] - Allow to Test eXo JCR 1.12 on EC2
+ * [EXOJCR-575] - Remove unused PairChangesLog class
+ * [EXOJCR-589] - Limit network traffic and thread blocking for the Lucene Indexer in a cluster
+ * [EXOJCR-590] - DO NOT exclude tests from a parent pom
+ * [EXOJCR-598] - Allow to disable the hints used for the Complex Queries on oracle
+ * [EXOJCR-605] - Normalize logging categories
+ * [EXOJCR-631] - Find a reason, why functional tests fails under Tornado.MySQL with "Cannot create PoolableConnectionFactory (Too many connections)" message.
+ * [EXOJCR-632] - svn: File 'jcr.packaging.module/1.12.0-CP01/jcr.packaging.module-1.12.0-CP01.js' has inconsistent newlines
+
+
+Features of eXoJCR 1.12 comparing to 1.11
+=========================================
+
+- Repository clustering based on JBossCache and JBoss Transactions.
+- Lazy-load option for child nodes and properties read, improved items dataflow for read/write operations
+- Alternative data container optimized for read operations (consuming less database queries)
+- Database dialect can be autodetected (if not pointed in the configuration)
+- Support for Values large of 2GiB
+- Portal container configuration improvements (default definitions, link and externaly loaded parameters)
+- Concurrency improvements for Session registry and Values stroage
+- Concurrency improvements for XA transactions support (Repository login and logout faster now)
+- Improved serach based on Lucene 2.4
+- Support of MySQL/InnoDB database for multi-language content
+- Standalone container can use configuration stored in JBossAS server configuration directory by default
+- WebDAV server update-policy can be configured to different versioning behaviour
+- Lot of WebDAV server bugfixes
+- HTTP (RESTful) Backup agent with concole client
+- HTTP (RESTful) Repository management service
+- Support of Java6 and Java5 runtime and development environment
+
+Since version of 1.12 eXoJCR available under LGPL license (version 2.1).
+
+eXoJCR 1.12 tested in on the databases:
+ MySQL 5.1 MYSQL Connector/J 5.1.8
+ Oracle DB 10g (10.2.0.1) Oracle 10g (10.2.0.1)
+ PostgresSQL 8.3.7 JDBC4 Driver, Version 8.3-605
+ DB2 9,7 IBM Data Server Driver for JDBC and SQLJ (JCC Driver) Version: 9.1 (fixpack 3a)
+ MS SQL Server 2005 SP3 JDBC Driver 2.0
+ MS SQL Server 2008 SP1 JDBC Driver 2.0
+ Sybase 15.0.2 JConnect v6.0.5 (Build 26564 / 11 Jun 2009)
+
+
+Release includes:
+* eXo Kernel 2.2.4-GA
+* eXo Core 2.3.4-GA
+* eXo WS 2.1.4-GA
+* eXo JCR 1.12.4-GA
+
+Find all 1.12 task on JIRA:
+https://jira.jboss.org/jira/browse/EXOJCR
+
+1.12.4-GA tasks:
+https://jira.jboss.org/browse/EXOJCR/fixforversion/12315137
+
+JCR Samples
+===========
+
+1. Start Up (Tomcat)
+ Tomcat 6 bundled can be started by executing the following commands:
+
+ $CATALINA_HOME\bin\eXo.bat run (Windows)
+
+ $CATALINA_HOME/bin/eXo.sh run (Unix)
+
+2. After startup, the sample applications will be available by visiting:
+
+ http://localhost:8080/browser - Simple JCR browser
+ Browse the JCR repository that was started with Tomcat
+ http://localhost:8080/fckeditor - FCK editor sample
+ Edits the sample node using FCKEditor and browse it JCR browser
+ http://localhost:8080/rest/jcr/repository/production - WebDAV service,
+ Open in Microsoft Explorer, File-Open-OpenAsWebFolder with url http://localhost:8080/rest/jcr/repository/production
+ Add/read/remove files there and browse it in the JCR browser or FTP.
+ User name/password: root/exo
+ ftp://localhost:2121 - FTP server
+ Open the repository in FTP client and browse the JCR repository started with Tomcat as FTP content,
+ add/read/remove files there and browse it in the JCR browser or WebDAV.
+
+EAR deploy
+==========
+
+eXo JCR was tested under JBoss-5.1.0.GA application server
+
+JBoss-5.1.0.GA
+
+ 1. Configuration
+
+ * Copy jcr.ear into $jboss_home/server/default/deploy
+ * Create $jboss_home/server/default/conf/exo-conf folder if it doesn't exist.
+ * Put exo-configuration.xml into $jboss_home/server/default/conf/exo-conf/exo-configuration.xml
+ * Configure JAAS by inserting XML fragment shown below into $jboss_home/server/default/conf/login-config.xml
+
+---------
+<application-policy name="exo-domain">
+ <authentication>
+ <login-module code="org.exoplatform.services.security.j2ee.JbossLoginModule" flag="required"></login-module>
+ </authentication>
+ </application-policy>
+---------
+
+ 2. Start Up
+
+ Execute
+ * bin/run.bat on Windows
+ or
+ * bin/run.sh on Unix
+
+Resources
+=========
+
+ Company site http://www.exoplatform.com
+ Documentation wiki http://wiki.exoplatform.org
+ Community JIRA https://jira.jboss.org/jira/browse/EXOJCR, http://jira.exoplatform.org
+ Comminity site http://www.exoplatform.org
+ Community forum http://www.exoplatform.com/portal/public/en/forum
+ JavaDoc site http://docs.exoplatform.org
+
\ No newline at end of file
15 years, 8 months
exo-jcr SVN: r3091 - jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2010-09-08 06:05:06 -0400 (Wed, 08 Sep 2010)
New Revision: 3091
Modified:
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/udp-mux.xml
Log:
EXOJCR-942: Disabled the message bundling in the JGroups Config as suggested by JBC
Modified: jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/udp-mux.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/udp-mux.xml 2010-09-08 09:53:15 UTC (rev 3090)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/udp-mux.xml 2010-09-08 10:05:06 UTC (rev 3091)
@@ -14,7 +14,7 @@
max_bundle_timeout="30"
use_incoming_packet_handler="true"
ip_ttl="${jgroups.udp.ip_ttl:2}"
- enable_bundling="true"
+ enable_bundling="false"
enable_diagnostics="true"
thread_naming_pattern="cl"
15 years, 8 months
exo-jcr SVN: r3090 - in jcr/trunk/exo.jcr.component.core/src: test/resources/conf/standalone/cluster and 1 other directory.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2010-09-08 05:53:15 -0400 (Wed, 08 Sep 2010)
New Revision: 3090
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/jbosscache/ExoJBossCacheFactory.java
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jbosscache-data.xml
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jbosscache-indexer.xml
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jbosscache-lock.xml
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jcr-config.xml
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/udp-mux.xml
Log:
EXOJCR-942: Allow to manage the shared transport and configure it by default
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/jbosscache/ExoJBossCacheFactory.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/jbosscache/ExoJBossCacheFactory.java 2010-09-08 07:40:32 UTC (rev 3089)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/jbosscache/ExoJBossCacheFactory.java 2010-09-08 09:53:15 UTC (rev 3090)
@@ -38,6 +38,7 @@
import java.io.IOException;
import java.io.InputStream;
+import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.HashMap;
@@ -70,7 +71,8 @@
public static final String JGROUPS_MUX_ENABLED = "jgroups-multiplexer-stack";
/**
- * Keep only one reference of the {@link JChannelFactory}
+ * Keep only one instance of the {@link JChannelFactory} to prevent creating several times the
+ * same multiplexer stack
*/
private static final JChannelFactory CHANNEL_FACTORY = new JChannelFactory();
@@ -78,8 +80,8 @@
* A Map that contains all the registered JBC instances, ordered by
* {@link ExoContainer} instances, {@link CacheType} and JBC Configuration.
*/
- private static Map<ExoContainer, Map<CacheType, Map<Configuration, Cache>>> CACHES =
- new HashMap<ExoContainer, Map<CacheType, Map<Configuration, Cache>>>();
+ private static Map<ExoContainer, Map<CacheType, Map<ConfigurationKey, Cache>>> CACHES =
+ new HashMap<ExoContainer, Map<CacheType, Map<ConfigurationKey, Cache>>>();
private final TemplateConfigurationHelper configurationHelper;
@@ -245,36 +247,38 @@
Cache<K, V> cache) throws RepositoryConfigurationException
{
ExoContainer container = ExoContainerContext.getCurrentContainer();
- Map<CacheType, Map<Configuration, Cache>> allCacheTypes = CACHES.get(container);
+ Map<CacheType, Map<ConfigurationKey, Cache>> allCacheTypes = CACHES.get(container);
if (allCacheTypes == null)
{
- allCacheTypes = new HashMap<CacheType, Map<Configuration, Cache>>();
+ allCacheTypes = new HashMap<CacheType, Map<ConfigurationKey, Cache>>();
CACHES.put(container, allCacheTypes);
}
- Map<Configuration, Cache> caches = allCacheTypes.get(cacheType);
+ Map<ConfigurationKey, Cache> caches = allCacheTypes.get(cacheType);
if (caches == null)
{
- caches = new HashMap<Configuration, Cache>();
+ caches = new HashMap<ConfigurationKey, Cache>();
allCacheTypes.put(cacheType, caches);
}
- Configuration cfg;
+ Configuration cfg = cache.getConfiguration();
+ ConfigurationKey key;
try
{
- cfg = cache.getConfiguration().clone();
- // Ignore the eviction config, since each cache will have his own region
- cfg.setEvictionConfig(null);
+ key = new ConfigurationKey(cfg);
}
catch (CloneNotSupportedException e)
{
throw new RepositoryConfigurationException("Cannot clone the configuration.", e);
}
- if (caches.containsKey(cfg))
+ if (caches.containsKey(key))
{
- cache = caches.get(cfg);
+ cache = caches.get(key);
}
else
{
- caches.put(cfg, cache);
+ caches.put(key, cache);
+ if (log.isInfoEnabled())
+ log.info("A new JBoss Cache instance has been registered fot the region " + rootFqn + ", a cache of type " + cacheType
+ + " and the container " + container.getContext().getName());
}
addEvictionRegion(rootFqn, cache, cfg);
if (log.isInfoEnabled())
@@ -290,4 +294,64 @@
{
JCR_CACHE, INDEX_CACHE, LOCK_CACHE
}
+
+ /**
+ * This class is used to make {@link Configuration} being usable as a Key in an HashMap since
+ * some variables such as <code>jgroupsConfigFile</code> are not managed as expected in the
+ * methods equals and hashCode. Moreover two cache with same config except the EvictionConfig
+ * are considered as identical
+ */
+ private static class ConfigurationKey
+ {
+ private final URL jgroupsConfigFile;
+ private final Configuration conf;
+
+ public ConfigurationKey(Configuration initialConf) throws CloneNotSupportedException
+ {
+ // Clone it first since it will be modified
+ this.conf = initialConf.clone();
+ this.jgroupsConfigFile = conf.getJGroupsConfigFile();
+ // remove the jgroupsConfigFile from the conf
+ conf.setJgroupsConfigFile(null);
+ // remove the EvictionConfig to ignore it
+ conf.setEvictionConfig(null);
+ }
+
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((conf == null) ? 0 : conf.hashCode());
+ result = prime * result + ((jgroupsConfigFile == null) ? 0 : jgroupsConfigFile.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ ConfigurationKey other = (ConfigurationKey)obj;
+ if (conf == null)
+ {
+ if (other.conf != null)
+ return false;
+ }
+ else if (!conf.equals(other.conf))
+ return false;
+ if (jgroupsConfigFile == null)
+ {
+ if (other.jgroupsConfigFile != null)
+ return false;
+ }
+ else if (!jgroupsConfigFile.equals(other.jgroupsConfigFile))
+ return false;
+ return true;
+ }
+ }
}
Modified: jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jbosscache-data.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jbosscache-data.xml 2010-09-08 07:40:32 UTC (rev 3089)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jbosscache-data.xml 2010-09-08 09:53:15 UTC (rev 3090)
@@ -6,7 +6,6 @@
<clustering mode="replication" clusterName="${jbosscache-cluster-name}">
<stateRetrieval timeout="20000" fetchInMemoryState="false" />
- <jgroupsConfig multiplexerStack="jcr.stack" />
<sync />
</clustering>
Modified: jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jbosscache-indexer.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jbosscache-indexer.xml 2010-09-08 07:40:32 UTC (rev 3089)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jbosscache-indexer.xml 2010-09-08 09:53:15 UTC (rev 3090)
@@ -8,7 +8,6 @@
<clustering mode="replication" clusterName="${jbosscache-cluster-name}">
<stateRetrieval timeout="20000" fetchInMemoryState="false" />
- <jgroupsConfig multiplexerStack="jcr.stack" />
<sync />
</clustering>
<!-- Eviction configuration -->
Modified: jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jbosscache-lock.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jbosscache-lock.xml 2010-09-08 07:40:32 UTC (rev 3089)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jbosscache-lock.xml 2010-09-08 09:53:15 UTC (rev 3090)
@@ -6,7 +6,6 @@
<clustering mode="replication" clusterName="${jbosscache-cluster-name}">
<stateRetrieval timeout="20000" fetchInMemoryState="false" />
- <jgroupsConfig multiplexerStack="jcr.stack" />
<sync />
</clustering>
Modified: jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jcr-config.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jcr-config.xml 2010-09-08 07:40:32 UTC (rev 3089)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jcr-config.xml 2010-09-08 09:53:15 UTC (rev 3090)
@@ -50,7 +50,7 @@
<properties>
<property name="jbosscache-configuration" value="test-jbosscache-data.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
- <property name="jgroups-multiplexer-stack" value="true" />
+ <property name="jgroups-multiplexer-stack" value="false" />
<property name="jbosscache-cluster-name" value="JCR-cluster-data" />
</properties>
</cache>
@@ -61,7 +61,7 @@
value="org.exoplatform.services.jcr.impl.core.query.jbosscache.JBossCacheIndexChangesFilter" />
<property name="jbosscache-configuration" value="test-jbosscache-indexer.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
- <property name="jgroups-multiplexer-stack" value="true" />
+ <property name="jgroups-multiplexer-stack" value="false" />
<property name="jbosscache-cluster-name" value="JCR-cluster-indexer" />
<property name="max-volatile-time" value="60" />
</properties>
@@ -71,7 +71,7 @@
<property name="time-out" value="15m" />
<property name="jbosscache-configuration" value="test-jbosscache-lock.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
- <property name="jgroups-multiplexer-stack" value="true" />
+ <property name="jgroups-multiplexer-stack" value="false" />
<property name="jbosscache-cluster-name" value="JCR-cluster-locks" />
<property name="jbosscache-cl-cache.jdbc.table.name" value="jcrlocks" />
<property name="jbosscache-cl-cache.jdbc.table.create" value="true" />
@@ -111,7 +111,7 @@
<properties>
<property name="jbosscache-configuration" value="test-jbosscache-data.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
- <property name="jgroups-multiplexer-stack" value="true" />
+ <property name="jgroups-multiplexer-stack" value="false" />
<property name="jbosscache-cluster-name" value="JCR-cluster-data" />
</properties>
</cache>
@@ -122,7 +122,7 @@
value="org.exoplatform.services.jcr.impl.core.query.jbosscache.JBossCacheIndexChangesFilter" />
<property name="jbosscache-configuration" value="test-jbosscache-indexer.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
- <property name="jgroups-multiplexer-stack" value="true" />
+ <property name="jgroups-multiplexer-stack" value="false" />
<property name="jbosscache-cluster-name" value="JCR-cluster-indexer" />
<property name="max-volatile-time" value="60" />
@@ -142,7 +142,7 @@
<property name="time-out" value="15m" />
<property name="jbosscache-configuration" value="test-jbosscache-lock.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
- <property name="jgroups-multiplexer-stack" value="true" />
+ <property name="jgroups-multiplexer-stack" value="false" />
<property name="jbosscache-cluster-name" value="JCR-cluster-locks" />
<property name="jbosscache-cl-cache.jdbc.table.name" value="jcrlocks" />
<property name="jbosscache-cl-cache.jdbc.table.create" value="true" />
@@ -182,7 +182,7 @@
<properties>
<property name="jbosscache-configuration" value="test-jbosscache-data.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
- <property name="jgroups-multiplexer-stack" value="true" />
+ <property name="jgroups-multiplexer-stack" value="false" />
<property name="jbosscache-cluster-name" value="JCR-cluster-data" />
</properties>
</cache>
@@ -193,7 +193,7 @@
value="org.exoplatform.services.jcr.impl.core.query.jbosscache.JBossCacheIndexChangesFilter" />
<property name="jbosscache-configuration" value="test-jbosscache-indexer.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
- <property name="jgroups-multiplexer-stack" value="true" />
+ <property name="jgroups-multiplexer-stack" value="false" />
<property name="jbosscache-cluster-name" value="JCR-cluster-indexer" />
<property name="max-volatile-time" value="60" />
@@ -213,7 +213,7 @@
<property name="time-out" value="15m" />
<property name="jbosscache-configuration" value="test-jbosscache-lock.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
- <property name="jgroups-multiplexer-stack" value="true" />
+ <property name="jgroups-multiplexer-stack" value="false" />
<property name="jbosscache-cluster-name" value="JCR-cluster-locks" />
<property name="jbosscache-cl-cache.jdbc.table.name" value="jcrlocks" />
<property name="jbosscache-cl-cache.jdbc.table.create" value="true" />
@@ -267,7 +267,7 @@
<properties>
<property name="jbosscache-configuration" value="test-jbosscache-data.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
- <property name="jgroups-multiplexer-stack" value="true" />
+ <property name="jgroups-multiplexer-stack" value="false" />
<property name="jbosscache-cluster-name" value="JCR-cluster-data" />
</properties>
</cache>
@@ -278,7 +278,7 @@
value="org.exoplatform.services.jcr.impl.core.query.jbosscache.JBossCacheIndexChangesFilter" />
<property name="jbosscache-configuration" value="test-jbosscache-indexer.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
- <property name="jgroups-multiplexer-stack" value="true" />
+ <property name="jgroups-multiplexer-stack" value="false" />
<property name="jbosscache-cluster-name" value="JCR-cluster-indexer" />
<property name="max-volatile-time" value="60" />
@@ -298,7 +298,7 @@
<property name="time-out" value="15m" />
<property name="jbosscache-configuration" value="test-jbosscache-lock.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
- <property name="jgroups-multiplexer-stack" value="true" />
+ <property name="jgroups-multiplexer-stack" value="false" />
<property name="jbosscache-cluster-name" value="JCR-cluster-locks" />
<property name="jbosscache-cl-cache.jdbc.table.name" value="jcrlocks" />
<property name="jbosscache-cl-cache.jdbc.table.create" value="true" />
@@ -357,7 +357,7 @@
<properties>
<property name="jbosscache-configuration" value="test-jbosscache-data.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
- <property name="jgroups-multiplexer-stack" value="true" />
+ <property name="jgroups-multiplexer-stack" value="false" />
<property name="jbosscache-cluster-name" value="JCR-cluster-data" />
</properties>
</cache>
@@ -368,7 +368,7 @@
value="org.exoplatform.services.jcr.impl.core.query.jbosscache.JBossCacheIndexChangesFilter" />
<property name="jbosscache-configuration" value="test-jbosscache-indexer.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
- <property name="jgroups-multiplexer-stack" value="true" />
+ <property name="jgroups-multiplexer-stack" value="false" />
<property name="jbosscache-cluster-name" value="JCR-cluster-indexer" />
<property name="max-volatile-time" value="60" />
@@ -388,7 +388,7 @@
<property name="time-out" value="15m" />
<property name="jbosscache-configuration" value="test-jbosscache-lock.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
- <property name="jgroups-multiplexer-stack" value="true" />
+ <property name="jgroups-multiplexer-stack" value="false" />
<property name="jbosscache-cluster-name" value="JCR-cluster-locks" />
<property name="jbosscache-cl-cache.jdbc.table.name" value="jcrlocks" />
<property name="jbosscache-cl-cache.jdbc.table.create" value="true" />
@@ -435,7 +435,7 @@
<properties>
<property name="jbosscache-configuration" value="test-jbosscache-data.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
- <property name="jgroups-multiplexer-stack" value="true" />
+ <property name="jgroups-multiplexer-stack" value="false" />
<property name="jbosscache-cluster-name" value="JCR-cluster-data" />
</properties>
</cache>
@@ -446,7 +446,7 @@
value="org.exoplatform.services.jcr.impl.core.query.jbosscache.JBossCacheIndexChangesFilter" />
<property name="jbosscache-configuration" value="test-jbosscache-indexer.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
- <property name="jgroups-multiplexer-stack" value="true" />
+ <property name="jgroups-multiplexer-stack" value="false" />
<property name="jbosscache-cluster-name" value="JCR-cluster-indexer" />
<property name="max-volatile-time" value="60" />
<property name="synonymprovider-class"
@@ -464,7 +464,7 @@
<property name="time-out" value="15m" />
<property name="jbosscache-configuration" value="test-jbosscache-lock.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
- <property name="jgroups-multiplexer-stack" value="true" />
+ <property name="jgroups-multiplexer-stack" value="false" />
<property name="jbosscache-cluster-name" value="JCR-cluster-locks" />
<property name="jbosscache-cl-cache.jdbc.table.name" value="jcrlocks" />
<property name="jbosscache-cl-cache.jdbc.table.create" value="true" />
@@ -511,7 +511,7 @@
<properties>
<property name="jbosscache-configuration" value="test-jbosscache-data.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
- <property name="jgroups-multiplexer-stack" value="true" />
+ <property name="jgroups-multiplexer-stack" value="false" />
<property name="jbosscache-cluster-name" value="JCR-cluster-data" />
</properties>
</cache>
@@ -522,7 +522,7 @@
value="org.exoplatform.services.jcr.impl.core.query.jbosscache.JBossCacheIndexChangesFilter" />
<property name="jbosscache-configuration" value="test-jbosscache-indexer.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
- <property name="jgroups-multiplexer-stack" value="true" />
+ <property name="jgroups-multiplexer-stack" value="false" />
<property name="jbosscache-cluster-name" value="JCR-cluster-indexer" />
<property name="max-volatile-time" value="60" />
<property name="synonymprovider-class"
@@ -543,7 +543,7 @@
<property name="time-out" value="15m" />
<property name="jbosscache-configuration" value="test-jbosscache-lock.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
- <property name="jgroups-multiplexer-stack" value="true" />
+ <property name="jgroups-multiplexer-stack" value="false" />
<property name="jbosscache-cluster-name" value="JCR-cluster-locks" />
<property name="jbosscache-cl-cache.jdbc.table.name" value="jcrlocks" />
<property name="jbosscache-cl-cache.jdbc.table.create" value="true" />
Modified: jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/udp-mux.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/udp-mux.xml 2010-09-08 07:40:32 UTC (rev 3089)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/udp-mux.xml 2010-09-08 09:53:15 UTC (rev 3090)
@@ -1,33 +1,65 @@
-<protocol_stacks>
- <stack name="jcr.stack">
- <config>
- <UDP mcast_addr="228.10.10.10" mcast_port="45588" tos="8" ucast_recv_buf_size="20000000"
- ucast_send_buf_size="640000" mcast_recv_buf_size="25000000" mcast_send_buf_size="640000" loopback="false"
- discard_incompatible_packets="true" max_bundle_size="64000" max_bundle_timeout="30"
- use_incoming_packet_handler="true" ip_ttl="2" enable_bundling="true" enable_diagnostics="true"
- thread_naming_pattern="cl" use_concurrent_stack="true" thread_pool.enabled="true" thread_pool.min_threads="2"
- thread_pool.max_threads="8" thread_pool.keep_alive_time="5000" thread_pool.queue_enabled="true"
- thread_pool.queue_max_size="1000" thread_pool.rejection_policy="discard" oob_thread_pool.enabled="true"
- oob_thread_pool.min_threads="1" oob_thread_pool.max_threads="8" oob_thread_pool.keep_alive_time="5000"
- oob_thread_pool.queue_enabled="false" oob_thread_pool.queue_max_size="100" oob_thread_pool.rejection_policy="Run" />
+<config>
+ <UDP
+ singleton_name="JCR-cluster"
+ mcast_addr="${jgroups.udp.mcast_addr:228.10.10.10}"
+ mcast_port="${jgroups.udp.mcast_port:45588}"
+ tos="8"
+ ucast_recv_buf_size="20000000"
+ ucast_send_buf_size="640000"
+ mcast_recv_buf_size="25000000"
+ mcast_send_buf_size="640000"
+ loopback="false"
+ discard_incompatible_packets="true"
+ max_bundle_size="64000"
+ max_bundle_timeout="30"
+ use_incoming_packet_handler="true"
+ ip_ttl="${jgroups.udp.ip_ttl:2}"
+ enable_bundling="true"
+ enable_diagnostics="true"
+ thread_naming_pattern="cl"
- <PING timeout="2000" num_initial_members="3" />
- <MERGE2 max_interval="30000" min_interval="10000" />
- <FD_SOCK />
- <FD timeout="10000" max_tries="5" shun="true" />
- <VERIFY_SUSPECT timeout="1500" />
- <BARRIER />
- <pbcast.NAKACK use_stats_for_retransmission="false" exponential_backoff="150" use_mcast_xmit="true"
- gc_lag="0" retransmit_timeout="50,300,600,1200" discard_delivered_msgs="true" />
- <UNICAST timeout="300,600,1200" />
- <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000" max_bytes="1000000" />
- <VIEW_SYNC avg_send_interval="60000" />
- <pbcast.GMS print_local_addr="true" join_timeout="3000" shun="false" view_bundling="true" />
- <FC max_credits="500000" min_threshold="0.20" />
- <FRAG2 frag_size="60000" />
- <!--pbcast.STREAMING_STATE_TRANSFER /-->
- <pbcast.STATE_TRANSFER />
- <!-- pbcast.FLUSH /-->
- </config>
- </stack>
-</protocol_stacks>
+ use_concurrent_stack="true"
+
+ thread_pool.enabled="true"
+ thread_pool.min_threads="2"
+ thread_pool.max_threads="8"
+ thread_pool.keep_alive_time="5000"
+ thread_pool.queue_enabled="true"
+ thread_pool.queue_max_size="1000"
+ thread_pool.rejection_policy="discard"
+
+ oob_thread_pool.enabled="true"
+ oob_thread_pool.min_threads="1"
+ oob_thread_pool.max_threads="8"
+ oob_thread_pool.keep_alive_time="5000"
+ oob_thread_pool.queue_enabled="false"
+ oob_thread_pool.queue_max_size="100"
+ oob_thread_pool.rejection_policy="Run" />
+
+ <PING timeout="2000"
+ num_initial_members="3"/>
+ <MERGE2 max_interval="30000"
+ min_interval="10000"/>
+ <FD_SOCK />
+ <FD timeout="10000" max_tries="5" shun="true" />
+ <VERIFY_SUSPECT timeout="1500" />
+ <BARRIER />
+ <pbcast.NAKACK use_stats_for_retransmission="false"
+ exponential_backoff="150"
+ use_mcast_xmit="true" gc_lag="0"
+ retransmit_timeout="50,300,600,1200"
+ discard_delivered_msgs="true"/>
+ <UNICAST timeout="300,600,1200" />
+ <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
+ max_bytes="1000000"/>
+ <VIEW_SYNC avg_send_interval="60000" />
+ <pbcast.GMS print_local_addr="true" join_timeout="3000"
+ shun="false"
+ view_bundling="true"/>
+ <FC max_credits="500000"
+ min_threshold="0.20"/>
+ <FRAG2 frag_size="60000" />
+ <!--pbcast.STREAMING_STATE_TRANSFER /-->
+ <pbcast.STATE_TRANSFER />
+ <!-- pbcast.FLUSH /-->
+</config>
15 years, 8 months
exo-jcr SVN: r3089 - in jcr/trunk/exo.jcr.component.core/src: main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache and 2 other directories.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2010-09-08 03:40:32 -0400 (Wed, 08 Sep 2010)
New Revision: 3089
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerCacheLoader.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/jbosscache/ExoJBossCacheFactory.java
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jcr-config.xml
Log:
EXOJCR-942: The JChannelFactory is now a static instance to avoid defining several times the same multiplexer stack, some info has been added into the log file and the configuration has been modified to ensure that only 3 cache instances will be created at the end (i.e. JCR_CACHE, LOCK_CACHE and INDEX_CACHE)
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java 2010-09-08 06:19:33 UTC (rev 3088)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java 2010-09-08 07:40:32 UTC (rev 3089)
@@ -258,7 +258,7 @@
configureJDBCCacheLoader(config.getLockManager());
cache = factory.createCache(config.getLockManager());
-
+
Fqn<String> rootFqn = Fqn.fromElements(config.getUniqueName());
cache = ExoJBossCacheFactory.getUniqueInstance(CacheType.LOCK_CACHE, rootFqn, cache);
cache.create();
@@ -266,7 +266,7 @@
{
// Add the cache loader needed to prevent TimeoutException
addCacheLoader();
- cache.start();
+ PrivilegedCacheHelper.start(cache);
}
createStructuredNode(lockRoot);
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerCacheLoader.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerCacheLoader.java 2010-09-08 06:19:33 UTC (rev 3088)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerCacheLoader.java 2010-09-08 07:40:32 UTC (rev 3089)
@@ -75,6 +75,7 @@
{
indexers.put(Fqn.fromElements(searchManager.getWsId()), new Indexer(searchManager, parentSearchManager, handler,
parentHandler));
+ if (log.isDebugEnabled()) log.debug("Register " + searchManager.getWsId() + " " + this + " in " + indexers);
}
/**
@@ -93,8 +94,16 @@
try
{
Indexer indexer = indexers.get(name.getParent());
- indexer.updateIndex(wrapper.getAddedNodes(), wrapper.getRemovedNodes(), wrapper.getParentAddedNodes(), wrapper
- .getParentRemovedNodes());
+ if (indexer == null)
+ {
+ log.warn("No indexer could be found for the fqn " + name.getParent());
+ if (log.isDebugEnabled()) log.debug("The current content of the map of indexers is " + indexers);
+ }
+ else
+ {
+ indexer.updateIndex(wrapper.getAddedNodes(), wrapper.getRemovedNodes(), wrapper.getParentAddedNodes(), wrapper
+ .getParentRemovedNodes());
+ }
}
finally
{
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/jbosscache/ExoJBossCacheFactory.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/jbosscache/ExoJBossCacheFactory.java 2010-09-08 06:19:33 UTC (rev 3088)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/jbosscache/ExoJBossCacheFactory.java 2010-09-08 07:40:32 UTC (rev 3089)
@@ -70,6 +70,11 @@
public static final String JGROUPS_MUX_ENABLED = "jgroups-multiplexer-stack";
/**
+ * Keep only one reference of the {@link JChannelFactory}
+ */
+ private static final JChannelFactory CHANNEL_FACTORY = new JChannelFactory();
+
+ /**
* A Map that contains all the registered JBC instances, ordered by
* {@link ExoContainer} instances, {@link CacheType} and JBC Configuration.
*/
@@ -170,17 +175,14 @@
if (jgroupsConfigurationFilePath != null)
{
// Create and inject multiplexer factory
- JChannelFactory muxFactory = new JChannelFactory();
- muxFactory.setMultiplexerConfig(configurationManager.getResource(jgroupsConfigurationFilePath));
-
- cache.getConfiguration().getRuntimeConfig().setMuxChannelFactory(muxFactory);
+ CHANNEL_FACTORY.setMultiplexerConfig(configurationManager.getResource(jgroupsConfigurationFilePath));
+ cache.getConfiguration().getRuntimeConfig().setMuxChannelFactory(CHANNEL_FACTORY);
log.info("Multiplexer stack successfully enabled for the cache.");
}
}
catch (Exception e)
{
// exception occurred setting mux factory
- e.printStackTrace();
throw new RepositoryConfigurationException("Error setting multiplexer configuration.", e);
}
}
@@ -259,6 +261,8 @@
try
{
cfg = cache.getConfiguration().clone();
+ // Ignore the eviction config, since each cache will have his own region
+ cfg.setEvictionConfig(null);
}
catch (CloneNotSupportedException e)
{
@@ -267,22 +271,23 @@
if (caches.containsKey(cfg))
{
cache = caches.get(cfg);
- if (log.isInfoEnabled())
- log.info("The region " + rootFqn + " has been registered for a cache of type " + cacheType
- + " and the container " + container.getContext().getName());
}
else
{
caches.put(cfg, cache);
}
addEvictionRegion(rootFqn, cache, cfg);
+ if (log.isInfoEnabled())
+ log.info("The region " + rootFqn + " has been registered for a cache of type " + cacheType
+ + " and the container " + container.getContext().getName());
return cache;
}
/**
* All the known cache types
*/
- public enum CacheType {
+ public enum CacheType
+ {
JCR_CACHE, INDEX_CACHE, LOCK_CACHE
- };
+ }
}
Modified: jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jcr-config.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jcr-config.xml 2010-09-08 06:19:33 UTC (rev 3088)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jcr-config.xml 2010-09-08 07:40:32 UTC (rev 3089)
@@ -51,7 +51,7 @@
<property name="jbosscache-configuration" value="test-jbosscache-data.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
<property name="jgroups-multiplexer-stack" value="true" />
- <property name="jbosscache-cluster-name" value="JCR-cluster-db1-ws" />
+ <property name="jbosscache-cluster-name" value="JCR-cluster-data" />
</properties>
</cache>
<query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
@@ -62,7 +62,7 @@
<property name="jbosscache-configuration" value="test-jbosscache-indexer.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
<property name="jgroups-multiplexer-stack" value="true" />
- <property name="jbosscache-cluster-name" value="JCR-cluster-indexer-db1-ws" />
+ <property name="jbosscache-cluster-name" value="JCR-cluster-indexer" />
<property name="max-volatile-time" value="60" />
</properties>
</query-handler>
@@ -72,11 +72,11 @@
<property name="jbosscache-configuration" value="test-jbosscache-lock.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
<property name="jgroups-multiplexer-stack" value="true" />
- <property name="jbosscache-cluster-name" value="JCR-cluster-locks-db1-ws" />
- <property name="jbosscache-cl-cache.jdbc.table.name" value="jcrlocks_db1_ws" />
+ <property name="jbosscache-cluster-name" value="JCR-cluster-locks" />
+ <property name="jbosscache-cl-cache.jdbc.table.name" value="jcrlocks" />
<property name="jbosscache-cl-cache.jdbc.table.create" value="true" />
<property name="jbosscache-cl-cache.jdbc.table.drop" value="false" />
- <property name="jbosscache-cl-cache.jdbc.table.primarykey" value="jcrlocks_db1_ws_pk" />
+ <property name="jbosscache-cl-cache.jdbc.table.primarykey" value="jcrlocks_pk" />
<property name="jbosscache-cl-cache.jdbc.fqn.column" value="fqn" />
<property name="jbosscache-cl-cache.jdbc.node.column" value="node" />
<property name="jbosscache-cl-cache.jdbc.parent.column" value="parent" />
@@ -112,7 +112,7 @@
<property name="jbosscache-configuration" value="test-jbosscache-data.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
<property name="jgroups-multiplexer-stack" value="true" />
- <property name="jbosscache-cluster-name" value="JCR-cluster-db1-ws1" />
+ <property name="jbosscache-cluster-name" value="JCR-cluster-data" />
</properties>
</cache>
<query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
@@ -123,7 +123,7 @@
<property name="jbosscache-configuration" value="test-jbosscache-indexer.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
<property name="jgroups-multiplexer-stack" value="true" />
- <property name="jbosscache-cluster-name" value="JCR-cluster-indexer-db1-ws1" />
+ <property name="jbosscache-cluster-name" value="JCR-cluster-indexer" />
<property name="max-volatile-time" value="60" />
<property name="synonymprovider-class"
@@ -143,11 +143,11 @@
<property name="jbosscache-configuration" value="test-jbosscache-lock.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
<property name="jgroups-multiplexer-stack" value="true" />
- <property name="jbosscache-cluster-name" value="JCR-cluster-locks-db1-ws1" />
- <property name="jbosscache-cl-cache.jdbc.table.name" value="jcrlocks_db1_ws1" />
+ <property name="jbosscache-cluster-name" value="JCR-cluster-locks" />
+ <property name="jbosscache-cl-cache.jdbc.table.name" value="jcrlocks" />
<property name="jbosscache-cl-cache.jdbc.table.create" value="true" />
<property name="jbosscache-cl-cache.jdbc.table.drop" value="false" />
- <property name="jbosscache-cl-cache.jdbc.table.primarykey" value="jcrlocks_db1_ws1_pk" />
+ <property name="jbosscache-cl-cache.jdbc.table.primarykey" value="jcrlocks_pk" />
<property name="jbosscache-cl-cache.jdbc.fqn.column" value="fqn" />
<property name="jbosscache-cl-cache.jdbc.node.column" value="node" />
<property name="jbosscache-cl-cache.jdbc.parent.column" value="parent" />
@@ -183,7 +183,7 @@
<property name="jbosscache-configuration" value="test-jbosscache-data.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
<property name="jgroups-multiplexer-stack" value="true" />
- <property name="jbosscache-cluster-name" value="JCR-cluster-db1-ws2" />
+ <property name="jbosscache-cluster-name" value="JCR-cluster-data" />
</properties>
</cache>
<query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
@@ -194,7 +194,7 @@
<property name="jbosscache-configuration" value="test-jbosscache-indexer.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
<property name="jgroups-multiplexer-stack" value="true" />
- <property name="jbosscache-cluster-name" value="JCR-cluster-indexer-db1-ws2" />
+ <property name="jbosscache-cluster-name" value="JCR-cluster-indexer" />
<property name="max-volatile-time" value="60" />
<property name="synonymprovider-class"
@@ -214,11 +214,11 @@
<property name="jbosscache-configuration" value="test-jbosscache-lock.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
<property name="jgroups-multiplexer-stack" value="true" />
- <property name="jbosscache-cluster-name" value="JCR-cluster-locks-db1-ws2" />
- <property name="jbosscache-cl-cache.jdbc.table.name" value="jcrlocks_db1_ws2" />
+ <property name="jbosscache-cluster-name" value="JCR-cluster-locks" />
+ <property name="jbosscache-cl-cache.jdbc.table.name" value="jcrlocks" />
<property name="jbosscache-cl-cache.jdbc.table.create" value="true" />
<property name="jbosscache-cl-cache.jdbc.table.drop" value="false" />
- <property name="jbosscache-cl-cache.jdbc.table.primarykey" value="jcrlocks_db1_ws2_pk" />
+ <property name="jbosscache-cl-cache.jdbc.table.primarykey" value="jcrlocks_pk" />
<property name="jbosscache-cl-cache.jdbc.fqn.column" value="fqn" />
<property name="jbosscache-cl-cache.jdbc.node.column" value="node" />
<property name="jbosscache-cl-cache.jdbc.parent.column" value="parent" />
@@ -268,7 +268,7 @@
<property name="jbosscache-configuration" value="test-jbosscache-data.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
<property name="jgroups-multiplexer-stack" value="true" />
- <property name="jbosscache-cluster-name" value="JCR-cluster-db1-ws3" />
+ <property name="jbosscache-cluster-name" value="JCR-cluster-data" />
</properties>
</cache>
<query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
@@ -279,7 +279,7 @@
<property name="jbosscache-configuration" value="test-jbosscache-indexer.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
<property name="jgroups-multiplexer-stack" value="true" />
- <property name="jbosscache-cluster-name" value="JCR-cluster-indexer-db1-ws3" />
+ <property name="jbosscache-cluster-name" value="JCR-cluster-indexer" />
<property name="max-volatile-time" value="60" />
<property name="synonymprovider-class"
@@ -299,11 +299,11 @@
<property name="jbosscache-configuration" value="test-jbosscache-lock.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
<property name="jgroups-multiplexer-stack" value="true" />
- <property name="jbosscache-cluster-name" value="JCR-cluster-locks-db1-ws3" />
- <property name="jbosscache-cl-cache.jdbc.table.name" value="jcrlocks_db1_ws3" />
+ <property name="jbosscache-cluster-name" value="JCR-cluster-locks" />
+ <property name="jbosscache-cl-cache.jdbc.table.name" value="jcrlocks" />
<property name="jbosscache-cl-cache.jdbc.table.create" value="true" />
<property name="jbosscache-cl-cache.jdbc.table.drop" value="false" />
- <property name="jbosscache-cl-cache.jdbc.table.primarykey" value="jcrlocks_db1_ws3_pk" />
+ <property name="jbosscache-cl-cache.jdbc.table.primarykey" value="jcrlocks_pk" />
<property name="jbosscache-cl-cache.jdbc.fqn.column" value="fqn" />
<property name="jbosscache-cl-cache.jdbc.node.column" value="node" />
<property name="jbosscache-cl-cache.jdbc.parent.column" value="parent" />
@@ -358,7 +358,7 @@
<property name="jbosscache-configuration" value="test-jbosscache-data.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
<property name="jgroups-multiplexer-stack" value="true" />
- <property name="jbosscache-cluster-name" value="JCR-cluster-db1tck-ws" />
+ <property name="jbosscache-cluster-name" value="JCR-cluster-data" />
</properties>
</cache>
<query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
@@ -369,7 +369,7 @@
<property name="jbosscache-configuration" value="test-jbosscache-indexer.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
<property name="jgroups-multiplexer-stack" value="true" />
- <property name="jbosscache-cluster-name" value="JCR-cluster-indexer-db1tck-ws" />
+ <property name="jbosscache-cluster-name" value="JCR-cluster-indexer" />
<property name="max-volatile-time" value="60" />
<property name="synonymprovider-class"
@@ -389,11 +389,11 @@
<property name="jbosscache-configuration" value="test-jbosscache-lock.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
<property name="jgroups-multiplexer-stack" value="true" />
- <property name="jbosscache-cluster-name" value="JCR-cluster-locks-db1tck-ws" />
- <property name="jbosscache-cl-cache.jdbc.table.name" value="jcrlocks_db1tck_ws" />
+ <property name="jbosscache-cluster-name" value="JCR-cluster-locks" />
+ <property name="jbosscache-cl-cache.jdbc.table.name" value="jcrlocks" />
<property name="jbosscache-cl-cache.jdbc.table.create" value="true" />
<property name="jbosscache-cl-cache.jdbc.table.drop" value="false" />
- <property name="jbosscache-cl-cache.jdbc.table.primarykey" value="jcrlocks_db1tck_ws_pk" />
+ <property name="jbosscache-cl-cache.jdbc.table.primarykey" value="jcrlocks_pk" />
<property name="jbosscache-cl-cache.jdbc.fqn.column" value="fqn" />
<property name="jbosscache-cl-cache.jdbc.node.column" value="node" />
<property name="jbosscache-cl-cache.jdbc.parent.column" value="parent" />
@@ -436,7 +436,7 @@
<property name="jbosscache-configuration" value="test-jbosscache-data.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
<property name="jgroups-multiplexer-stack" value="true" />
- <property name="jbosscache-cluster-name" value="JCR-cluster-db1tck-ws1" />
+ <property name="jbosscache-cluster-name" value="JCR-cluster-data" />
</properties>
</cache>
<query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
@@ -447,7 +447,7 @@
<property name="jbosscache-configuration" value="test-jbosscache-indexer.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
<property name="jgroups-multiplexer-stack" value="true" />
- <property name="jbosscache-cluster-name" value="JCR-cluster-indexer-db1tck-ws1" />
+ <property name="jbosscache-cluster-name" value="JCR-cluster-indexer" />
<property name="max-volatile-time" value="60" />
<property name="synonymprovider-class"
value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
@@ -465,11 +465,11 @@
<property name="jbosscache-configuration" value="test-jbosscache-lock.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
<property name="jgroups-multiplexer-stack" value="true" />
- <property name="jbosscache-cluster-name" value="JCR-cluster-locks-db1tck-ws1" />
- <property name="jbosscache-cl-cache.jdbc.table.name" value="jcrlocks_db1tck_ws1" />
+ <property name="jbosscache-cluster-name" value="JCR-cluster-locks" />
+ <property name="jbosscache-cl-cache.jdbc.table.name" value="jcrlocks" />
<property name="jbosscache-cl-cache.jdbc.table.create" value="true" />
<property name="jbosscache-cl-cache.jdbc.table.drop" value="false" />
- <property name="jbosscache-cl-cache.jdbc.table.primarykey" value="jcrlocks_db1tck_ws1_pk" />
+ <property name="jbosscache-cl-cache.jdbc.table.primarykey" value="jcrlocks_pk" />
<property name="jbosscache-cl-cache.jdbc.fqn.column" value="fqn" />
<property name="jbosscache-cl-cache.jdbc.node.column" value="node" />
<property name="jbosscache-cl-cache.jdbc.parent.column" value="parent" />
@@ -512,7 +512,7 @@
<property name="jbosscache-configuration" value="test-jbosscache-data.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
<property name="jgroups-multiplexer-stack" value="true" />
- <property name="jbosscache-cluster-name" value="JCR-cluster-db1tck-ws2" />
+ <property name="jbosscache-cluster-name" value="JCR-cluster-data" />
</properties>
</cache>
<query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
@@ -523,7 +523,7 @@
<property name="jbosscache-configuration" value="test-jbosscache-indexer.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
<property name="jgroups-multiplexer-stack" value="true" />
- <property name="jbosscache-cluster-name" value="JCR-cluster-indexer-db1tck-ws2" />
+ <property name="jbosscache-cluster-name" value="JCR-cluster-indexer" />
<property name="max-volatile-time" value="60" />
<property name="synonymprovider-class"
value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
@@ -544,11 +544,11 @@
<property name="jbosscache-configuration" value="test-jbosscache-lock.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
<property name="jgroups-multiplexer-stack" value="true" />
- <property name="jbosscache-cluster-name" value="JCR-cluster-locks-db1tck-ws2" />
- <property name="jbosscache-cl-cache.jdbc.table.name" value="jcrlocks_db1tck_ws2" />
+ <property name="jbosscache-cluster-name" value="JCR-cluster-locks" />
+ <property name="jbosscache-cl-cache.jdbc.table.name" value="jcrlocks" />
<property name="jbosscache-cl-cache.jdbc.table.create" value="true" />
<property name="jbosscache-cl-cache.jdbc.table.drop" value="false" />
- <property name="jbosscache-cl-cache.jdbc.table.primarykey" value="jcrlocks_db1tck_ws2_pk" />
+ <property name="jbosscache-cl-cache.jdbc.table.primarykey" value="jcrlocks_pk" />
<property name="jbosscache-cl-cache.jdbc.fqn.column" value="fqn" />
<property name="jbosscache-cl-cache.jdbc.node.column" value="node" />
<property name="jbosscache-cl-cache.jdbc.parent.column" value="parent" />
15 years, 8 months
exo-jcr SVN: r3088 - in jcr/trunk/exo.jcr.component.core/src: test/java/org/exoplatform/services/jcr/impl/core/query and 1 other directories.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2010-09-08 02:19:33 -0400 (Wed, 08 Sep 2010)
New Revision: 3088
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/query/TestExcelFileSearch.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/index/SlowListTest.java
Log:
EXOJCR-752: NodeIndexer now can use AdvancedDocumentReaders Reader object
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java 2010-09-07 19:29:32 UTC (rev 3087)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java 2010-09-08 06:19:33 UTC (rev 3088)
@@ -19,6 +19,7 @@
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.Fieldable;
+import org.exoplatform.services.document.AdvancedDocumentReader;
import org.exoplatform.services.document.DocumentReadException;
import org.exoplatform.services.document.DocumentReader;
import org.exoplatform.services.document.DocumentReaderService;
@@ -328,42 +329,53 @@
PropertyData encProp =
(PropertyData)stateProvider.getItemData(node, new QPathEntry(Constants.JCR_ENCODING, 0));
+ String encoding = null;
if (encProp != null)
{
// encoding parameter used
- String encoding = new String(encProp.getValues().get(0).getAsByteArray());
+ encoding = new String(encProp.getValues().get(0).getAsByteArray());
+ }
+
+ if (dreader instanceof AdvancedDocumentReader)
+ {
+ // its a tika document reader that supports getContentAsReader
for (ValueData pvd : data)
{
+ // tikaDocumentReader will close inputStream, so no need to close it at finally
+ // statement
+
InputStream is = null;
- try
+ is = pvd.getAsStream();
+ Reader reader;
+ if (encoding != null)
{
- is = pvd.getAsStream();
- Reader reader = new StringReader(dreader.getContentAsText(is, encoding));
- doc.add(createFulltextField(reader));
-
+ reader = ((AdvancedDocumentReader)dreader).getContentAsReader(is, encoding);
}
- finally
+ else
{
- try
- {
- is.close();
- }
- catch (Throwable e)
- {
- }
+ reader = ((AdvancedDocumentReader)dreader).getContentAsReader(is);
}
+ doc.add(createFulltextField(reader));
}
}
else
{
- // no encoding parameter
+ // old-style document reader
for (ValueData pvd : data)
{
InputStream is = null;
try
{
is = pvd.getAsStream();
- Reader reader = new StringReader(dreader.getContentAsText(is));
+ Reader reader;
+ if (encoding != null)
+ {
+ reader = new StringReader(dreader.getContentAsText(is, encoding));
+ }
+ else
+ {
+ reader = new StringReader(dreader.getContentAsText(is));
+ }
doc.add(createFulltextField(reader));
}
finally
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/query/TestExcelFileSearch.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/query/TestExcelFileSearch.java 2010-09-07 19:29:32 UTC (rev 3087)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/query/TestExcelFileSearch.java 2010-09-08 06:19:33 UTC (rev 3088)
@@ -26,6 +26,7 @@
import org.exoplatform.services.document.DocumentReader;
import org.exoplatform.services.document.DocumentReaderService;
import org.exoplatform.services.document.impl.MSExcelDocumentReader;
+import org.exoplatform.services.document.impl.tika.TikaDocumentReader;
import org.exoplatform.services.jcr.impl.core.NodeImpl;
import org.exoplatform.services.jcr.impl.core.query.lucene.FieldNames;
@@ -68,7 +69,19 @@
System.out.println(dreader);
- assertTrue(dreader instanceof MSExcelDocumentReader);
+ if (dreader instanceof MSExcelDocumentReader)
+ {
+ // OK
+ }
+ else if (dreader instanceof TikaDocumentReader)
+ {
+ String[] mimetypes = ((TikaDocumentReader)dreader).getMimeTypes();
+ assertEquals("application/excel", mimetypes[0]);
+ }
+ else
+ {
+ fail("Wrong document reader");
+ }
// String text = dreader.getContentAsText(fis);
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/index/SlowListTest.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/index/SlowListTest.java 2010-09-07 19:29:32 UTC (rev 3087)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/index/SlowListTest.java 2010-09-08 06:19:33 UTC (rev 3088)
@@ -56,10 +56,11 @@
assertNotNull("Can not create a test node for indexing", test);
for (int i = 0; i < 111; i++)
{
+ is = SlowListTest.class.getResourceAsStream("/index/test_index.xls");
String name = new String("nnn-" + i);
Node cool = test.addNode(name, "nt:file");
Node contentNode = cool.addNode("jcr:content", "nt:resource");
- contentNode.setProperty("jcr:encoding", "UTF-8");
+ //contentNode.setProperty("jcr:encoding", "UTF-8");
contentNode.setProperty("jcr:data", is);
contentNode.setProperty("jcr:mimeType", "application/excel");
contentNode.setProperty("jcr:lastModified", session.getValueFactory().createValue(Calendar.getInstance()));
15 years, 8 months