Author: nzamosenchuk
Date: 2011-02-28 04:25:46 -0500 (Mon, 28 Feb 2011)
New Revision: 4023
Added:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/AbstractIndexerCacheStore.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/LocalIndexCacheStore.java
Removed:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/AbstractInputCacheStore.java
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexChangesFilter.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/IndexerCacheStore.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/LocalIndexChangesFilter.java
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-infinispan-indexer.xml
Log:
EXOJCR-832 : Added CacheStore implementations for default and local index behaviors.
Copied:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/AbstractIndexerCacheStore.java
(from rev 4018,
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/AbstractInputCacheStore.java)
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/AbstractIndexerCacheStore.java
(rev 0)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/AbstractIndexerCacheStore.java 2011-02-28
09:25:46 UTC (rev 4023)
@@ -0,0 +1,218 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.exoplatform.services.jcr.impl.core.query.ispn;
+
+import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
+import org.exoplatform.services.jcr.impl.core.query.Indexer;
+import org.exoplatform.services.jcr.impl.core.query.IndexerIoMode;
+import org.exoplatform.services.jcr.impl.core.query.IndexerIoModeHandler;
+import org.exoplatform.services.jcr.impl.core.query.QueryHandler;
+import org.exoplatform.services.jcr.impl.core.query.SearchManager;
+import
org.exoplatform.services.jcr.impl.core.query.jbosscache.ChangesFilterListsWrapper;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+import org.infinispan.container.entries.InternalCacheEntry;
+import org.infinispan.loaders.AbstractCacheStore;
+import org.infinispan.loaders.AbstractCacheStoreConfig;
+import org.infinispan.loaders.CacheLoaderConfig;
+import org.infinispan.loaders.CacheLoaderException;
+
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Abstract Indexer Cache Loader defines default implementation of data processing
received via cache.
+ *
+ * @author <a href="mailto:nikolazius@gmail.com">Nikolay
Zamosenchuk</a>
+ * @version $Id: AbstractInputCacheStore.java 34360 2009-07-22 23:58:59Z nzamosenchuk $
+ *
+ */
+public abstract class AbstractIndexerCacheStore extends AbstractCacheStore
+{
+
+ /**
+ * A map of all the indexers that has been registered
+ */
+ protected final Map<Integer, Indexer> indexers = new HashMap<Integer,
Indexer>();
+
+ protected static final Log log =
ExoLogger.getLogger("exo.jcr.component.core.IndexerCacheLoader");
+
+ /**
+ * This method will register a new Indexer according to the given parameters.
+ *
+ * @param searchManager
+ * @param parentSearchManager
+ * @param handler
+ * @param parentHandler
+ * @throws RepositoryConfigurationException
+ */
+ public void register(SearchManager searchManager, SearchManager parentSearchManager,
QueryHandler handler,
+ QueryHandler parentHandler) throws RepositoryConfigurationException
+ {
+ indexers.put(searchManager.getWsId().hashCode(), new Indexer(searchManager,
parentSearchManager, handler,
+ parentHandler));
+ if (log.isDebugEnabled())
+ {
+ log.debug("Register " + searchManager.getWsId() + " " + this
+ " in " + indexers);
+ }
+ }
+
+ /**
+ * @see
org.infinispan.loaders.CacheStore#store(org.infinispan.container.entries.InternalCacheEntry)
+ */
+ public void store(InternalCacheEntry entry) throws CacheLoaderException
+ {
+ if (entry.getValue() instanceof ChangesFilterListsWrapper && entry.getKey()
instanceof ChangesKey)
+ {
+ if (log.isDebugEnabled())
+ {
+ log.info("Received list wrapper, start indexing...");
+ }
+ // updating index
+ ChangesFilterListsWrapper wrapper =
(ChangesFilterListsWrapper)entry.getValue();
+ ChangesKey key = (ChangesKey)entry.getKey();
+ try
+ {
+ Indexer indexer = indexers.get(key.getWsId());
+ if (indexer == null)
+ {
+ log.warn("No indexer could be found for the cache entry " +
key.toString());
+ if (log.isDebugEnabled())
+ {
+ log.debug("The current content of the map of indexers is " +
indexers);
+ }
+ }
+ else if (wrapper.withChanges())
+ {
+ indexer.updateIndex(wrapper.getChanges(), wrapper.getParentChanges());
+ }
+ else
+ {
+ indexer.updateIndex(wrapper.getAddedNodes(), wrapper.getRemovedNodes(),
wrapper.getParentAddedNodes(),
+ wrapper.getParentRemovedNodes());
+ }
+ }
+ finally
+ {
+ if (getModeHandler().getMode() == IndexerIoMode.READ_WRITE)
+ {
+ // remove the data from the cache
+ cache.remove(key);
+ }
+ }
+ }
+ }
+
+ /**
+ * @return IndexerIoModeHandler instance
+ */
+ public abstract IndexerIoModeHandler getModeHandler();
+
+ // ===================================================
+
+ /**
+ * @see org.infinispan.loaders.CacheLoader#getConfigurationClass()
+ */
+ public Class<? extends CacheLoaderConfig> getConfigurationClass()
+ {
+ return AbstractCacheStoreConfig.class;
+ }
+
+ /**
+ * @see org.infinispan.loaders.CacheStore#fromStream(java.io.ObjectInput)
+ */
+ public void fromStream(ObjectInput inputStream) throws CacheLoaderException
+ {
+ throw new UnsupportedOperationException("This operation is not supported by
this component.");
+ }
+
+ /**
+ * @see org.infinispan.loaders.CacheStore#toStream(java.io.ObjectOutput)
+ */
+ public void toStream(ObjectOutput outputStream) throws CacheLoaderException
+ {
+ throw new UnsupportedOperationException("This operation is not supported by
this component.");
+ }
+
+ /**
+ * @see org.infinispan.loaders.AbstractCacheStore#purgeInternal()
+ */
+ @Override
+ protected void purgeInternal() throws CacheLoaderException
+ {
+ // This cacheStore only accepts data
+ }
+
+ /**
+ * @see org.infinispan.loaders.CacheStore#clear()
+ */
+ public void clear() throws CacheLoaderException
+ {
+ throw new UnsupportedOperationException("This operation is not supported by
this component.");
+ }
+
+ /**
+ * @see org.infinispan.loaders.CacheStore#remove(java.lang.Object)
+ */
+ public boolean remove(Object key) throws CacheLoaderException
+ {
+ // This cacheStore only accepts data
+ return true;
+ }
+
+ /**
+ * @see org.infinispan.loaders.CacheLoader#load(java.lang.Object)
+ */
+ public InternalCacheEntry load(Object key) throws CacheLoaderException
+ {
+ // This cacheStore only accepts data
+ return null;
+ }
+
+ /**
+ * @see org.infinispan.loaders.CacheLoader#load(int)
+ */
+ public Set<InternalCacheEntry> load(int numEntries) throws CacheLoaderException
+ {
+ // This cacheStore only accepts data
+ return null;
+ }
+
+ /**
+ * @see org.infinispan.loaders.CacheLoader#loadAll()
+ */
+ public Set<InternalCacheEntry> loadAll() throws CacheLoaderException
+ {
+ // This cacheStore only accepts data
+ return null;
+ }
+
+ /**
+ * @see org.infinispan.loaders.CacheLoader#loadAllKeys(java.util.Set)
+ */
+ public Set<Object> loadAllKeys(Set<Object> keysToExclude) throws
CacheLoaderException
+ {
+ // This cacheStore only accepts data
+ return null;
+ }
+
+}
\ No newline at end of file
Property changes on:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/AbstractIndexerCacheStore.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Deleted:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/AbstractInputCacheStore.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/AbstractInputCacheStore.java 2011-02-28
07:46:58 UTC (rev 4022)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/AbstractInputCacheStore.java 2011-02-28
09:25:46 UTC (rev 4023)
@@ -1,133 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.impl.core.query.ispn;
-
-import org.infinispan.container.entries.InternalCacheEntry;
-import org.infinispan.loaders.AbstractCacheStore;
-import org.infinispan.loaders.AbstractCacheStoreConfig;
-import org.infinispan.loaders.CacheLoaderConfig;
-import org.infinispan.loaders.CacheLoaderException;
-
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.util.Set;
-
-/**
- * @author <a href="mailto:nikolazius@gmail.com">Nikolay
Zamosenchuk</a>
- * @version $Id: AbstractInputCacheStore.java 34360 2009-07-22 23:58:59Z nzamosenchuk $
- *
- */
-public abstract class AbstractInputCacheStore extends AbstractCacheStore
-{
-
- /**
- *
- */
- public AbstractInputCacheStore()
- {
- super();
- }
-
- /**
- * @see org.infinispan.loaders.CacheLoader#getConfigurationClass()
- */
- public Class<? extends CacheLoaderConfig> getConfigurationClass()
- {
- return AbstractCacheStoreConfig.class;
- }
-
- /**
- * @see org.infinispan.loaders.CacheStore#fromStream(java.io.ObjectInput)
- */
- public void fromStream(ObjectInput inputStream) throws CacheLoaderException
- {
- throw new UnsupportedOperationException("This operation is not supported by
this component.");
- }
-
- /**
- * @see org.infinispan.loaders.CacheStore#toStream(java.io.ObjectOutput)
- */
- public void toStream(ObjectOutput outputStream) throws CacheLoaderException
- {
- throw new UnsupportedOperationException("This operation is not supported by
this component.");
- }
-
- /**
- * @see org.infinispan.loaders.AbstractCacheStore#purgeInternal()
- */
- @Override
- protected void purgeInternal() throws CacheLoaderException
- {
- // This cacheStore only accepts data
- }
-
- /**
- * @see org.infinispan.loaders.CacheStore#clear()
- */
- public void clear() throws CacheLoaderException
- {
- throw new UnsupportedOperationException("This operation is not supported by
this component.");
- }
-
- /**
- * @see org.infinispan.loaders.CacheStore#remove(java.lang.Object)
- */
- public boolean remove(Object key) throws CacheLoaderException
- {
- // This cacheStore only accepts data
- return false;
- }
-
- /**
- * @see org.infinispan.loaders.CacheLoader#load(java.lang.Object)
- */
- public InternalCacheEntry load(Object key) throws CacheLoaderException
- {
- // This cacheStore only accepts data
- return null;
- }
-
- /**
- * @see org.infinispan.loaders.CacheLoader#load(int)
- */
- public Set<InternalCacheEntry> load(int numEntries) throws CacheLoaderException
- {
- // This cacheStore only accepts data
- return null;
- }
-
- /**
- * @see org.infinispan.loaders.CacheLoader#loadAll()
- */
- public Set<InternalCacheEntry> loadAll() throws CacheLoaderException
- {
- // This cacheStore only accepts data
- return null;
- }
-
- /**
- * @see org.infinispan.loaders.CacheLoader#loadAllKeys(java.util.Set)
- */
- public Set<Object> loadAllKeys(Set<Object> keysToExclude) throws
CacheLoaderException
- {
- // This cacheStore only accepts data
- return null;
- }
-
-}
\ No newline at end of file
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexChangesFilter.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexChangesFilter.java 2011-02-28
07:46:58 UTC (rev 4022)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexChangesFilter.java 2011-02-28
09:25:46 UTC (rev 4023)
@@ -59,6 +59,8 @@
*/
private final Log log =
ExoLogger.getLogger("exo.jcr.component.core.ISPNIndexChangesFilter");
+ public static final String PARAM_INFINISPAN_CACHESTORE_CLASS =
"infinispan-cachestore-classname";
+
/**
* ISPN cache.
*/
@@ -82,6 +84,7 @@
this.wsId = searchManager.getWsId().hashCode();
ISPNCacheFactory<Serializable, Object> factory = new
ISPNCacheFactory<Serializable, Object>(cfm);
+ config.putParameterValue(PARAM_INFINISPAN_CACHESTORE_CLASS,
IndexerCacheStore.class.getName());
this.cache = factory.createCache("Indexer-" + searchManager.getWsId(),
config);
CacheLoaderManager cacheLoaderManager =
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/IndexerCacheStore.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/IndexerCacheStore.java 2011-02-28
07:46:58 UTC (rev 4022)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/IndexerCacheStore.java 2011-02-28
09:25:46 UTC (rev 4023)
@@ -18,16 +18,10 @@
*/
package org.exoplatform.services.jcr.impl.core.query.ispn;
-import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
-import org.exoplatform.services.jcr.impl.core.query.Indexer;
import org.exoplatform.services.jcr.impl.core.query.IndexerIoMode;
import org.exoplatform.services.jcr.impl.core.query.IndexerIoModeHandler;
-import org.exoplatform.services.jcr.impl.core.query.QueryHandler;
-import org.exoplatform.services.jcr.impl.core.query.SearchManager;
import
org.exoplatform.services.jcr.impl.core.query.jbosscache.ChangesFilterListsWrapper;
import org.exoplatform.services.jcr.util.IdGenerator;
-import org.exoplatform.services.log.ExoLogger;
-import org.exoplatform.services.log.Log;
import org.infinispan.Cache;
import org.infinispan.container.DataContainer;
import org.infinispan.container.entries.InternalCacheEntry;
@@ -52,12 +46,16 @@
import java.util.Map.Entry;
/**
+ * Implements Cache Store for clustered environment. It gives control of Index for
coordinator and
+ * adds failover mechanisms when it changes.
+ *
* @author <a href="mailto:nikolazius@gmail.com">Nikolay
Zamosenchuk</a>
* @version $Id: IndexCacheLoader.java 34360 2009-07-22 23:58:59Z nzamosenchuk $
*
*/
-public class IndexerCacheStore extends AbstractInputCacheStore
+public class IndexerCacheStore extends AbstractIndexerCacheStore
{
+ protected volatile IndexerIoModeHandler modeHandler;
protected CacheListener listener;
@@ -73,37 +71,8 @@
*/
private volatile boolean coordinator;
- EmbeddedCacheManager cacheManager;
+ protected EmbeddedCacheManager cacheManager;
- protected volatile IndexerIoModeHandler modeHandler;
-
- /**
- * A map of all the indexers that has been registered
- */
- private final Map<Integer, Indexer> indexers = new HashMap<Integer,
Indexer>();
-
- private static final Log log =
ExoLogger.getLogger("exo.jcr.component.core.IndexerCacheLoader");
-
- /**
- * This method will register a new Indexer according to the given parameters.
- *
- * @param searchManager
- * @param parentSearchManager
- * @param handler
- * @param parentHandler
- * @throws RepositoryConfigurationException
- */
- public void register(SearchManager searchManager, SearchManager parentSearchManager,
QueryHandler handler,
- QueryHandler parentHandler) throws RepositoryConfigurationException
- {
- indexers.put(searchManager.getWsId().hashCode(), new Indexer(searchManager,
parentSearchManager, handler,
- parentHandler));
- if (log.isDebugEnabled())
- {
- log.debug("Register " + searchManager.getWsId() + " " + this
+ " in " + indexers);
- }
- }
-
@Override
public void init(CacheLoaderConfig config, Cache<?, ?> cache,
StreamingMarshaller m) throws CacheLoaderException
{
@@ -114,56 +83,10 @@
}
/**
- * @see
org.infinispan.loaders.CacheStore#store(org.infinispan.container.entries.InternalCacheEntry)
- */
- public void store(InternalCacheEntry entry) throws CacheLoaderException
- {
- if (entry.getValue() instanceof ChangesFilterListsWrapper && entry.getKey()
instanceof ChangesKey)
- {
- if (log.isDebugEnabled())
- {
- log.info("Received list wrapper, start indexing...");
- }
- // updating index
- ChangesFilterListsWrapper wrapper =
(ChangesFilterListsWrapper)entry.getValue();
- ChangesKey key = (ChangesKey)entry.getKey();
- try
- {
- Indexer indexer = indexers.get(key.getWsId());
- if (indexer == null)
- {
- log.warn("No indexer could be found for the cache entry " +
key.toString());
- if (log.isDebugEnabled())
- {
- log.debug("The current content of the map of indexers is " +
indexers);
- }
- }
- else if (wrapper.withChanges())
- {
- indexer.updateIndex(wrapper.getChanges(), wrapper.getParentChanges());
- }
- else
- {
- indexer.updateIndex(wrapper.getAddedNodes(), wrapper.getRemovedNodes(),
wrapper.getParentAddedNodes(),
- wrapper.getParentRemovedNodes());
- }
- }
- finally
- {
- if (modeHandler.getMode() == IndexerIoMode.READ_WRITE)
- {
- // remove the data from the cache
- cache.remove(key);
- }
- }
- }
- }
-
- /**
* Set the mode handler
* @param modeHandler
*/
- IndexerIoModeHandler getModeHandler()
+ public IndexerIoModeHandler getModeHandler()
{
if (modeHandler == null)
{
@@ -232,6 +155,9 @@
}
}
+ /**
+ * Flushes all cache content to underlying CacheStore
+ */
protected void doPushState()
{
final boolean debugEnabled = log.isDebugEnabled();
Added:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/LocalIndexCacheStore.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/LocalIndexCacheStore.java
(rev 0)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/LocalIndexCacheStore.java 2011-02-28
09:25:46 UTC (rev 4023)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.exoplatform.services.jcr.impl.core.query.ispn;
+
+import org.exoplatform.services.jcr.impl.core.query.IndexerIoMode;
+import org.exoplatform.services.jcr.impl.core.query.IndexerIoModeHandler;
+
+/**
+ * Implements Cache Store that designed to be used when each cluster node has it's
own local index
+ *
+ * @author <a href="mailto:nikolazius@gmail.com">Nikolay
Zamosenchuk</a>
+ * @version $Id: LocalIndexerCacheStore.java 34360 2009-07-22 23:58:59Z nzamosenchuk $
+ *
+ */
+public class LocalIndexCacheStore extends AbstractIndexerCacheStore
+{
+
+ protected volatile IndexerIoModeHandler modeHandler;
+
+ public LocalIndexCacheStore()
+ {
+ super();
+ this.modeHandler = new IndexerIoModeHandler(IndexerIoMode.READ_WRITE); //
initialize mode handler
+ }
+
+ @Override
+ public IndexerIoModeHandler getModeHandler()
+ {
+ return modeHandler;
+ }
+
+}
Property changes on:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/LocalIndexCacheStore.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/LocalIndexChangesFilter.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/LocalIndexChangesFilter.java 2011-02-28
07:46:58 UTC (rev 4022)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/LocalIndexChangesFilter.java 2011-02-28
09:25:46 UTC (rev 4023)
@@ -62,6 +62,8 @@
*/
private final Log log =
ExoLogger.getLogger("exo.jcr.component.core.LocalIndexChangesFilter");
+ public static final String PARAM_INFINISPAN_CACHESTORE_CLASS =
"infinispan-cachestore-classname";
+
private final Cache<Serializable, Object> cache;
private final int wsId;
@@ -77,13 +79,13 @@
super(searchManager, parentSearchManager, config, indexingTree, parentIndexingTree,
handler, parentHandler, cfm);
this.wsId = searchManager.getWsId().hashCode();
-
ISPNCacheFactory<Serializable, Object> factory = new
ISPNCacheFactory<Serializable, Object>(cfm);
+ config.putParameterValue(PARAM_INFINISPAN_CACHESTORE_CLASS,
LocalIndexCacheStore.class.getName());
this.cache = factory.createCache("Indexer-" + searchManager.getWsId(),
config);
CacheLoaderManager cacheLoaderManager =
cache.getAdvancedCache().getComponentRegistry().getComponent(CacheLoaderManager.class);
- IndexerCacheStore cacheStore =
(IndexerCacheStore)cacheLoaderManager.getCacheLoader();
+ AbstractIndexerCacheStore cacheStore =
(AbstractIndexerCacheStore)cacheLoaderManager.getCacheLoader();
cacheStore.register(searchManager, parentSearchManager, handler, parentHandler);
IndexerIoModeHandler modeHandler = cacheStore.getModeHandler();
Modified:
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-infinispan-indexer.xml
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-infinispan-indexer.xml 2011-02-28
07:46:58 UTC (rev 4022)
+++
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-infinispan-indexer.xml 2011-02-28
09:25:46 UTC (rev 4023)
@@ -52,7 +52,7 @@
<deadlockDetection enabled="true" spinDuration="100"/>
<loaders passivation="false" shared="false"
preload="false">
- <loader
class="org.exoplatform.services.jcr.impl.core.query.ispn.IndexerCacheStore"
fetchPersistentState="false" ignoreModifications="false"
purgeOnStartup="false">
+ <loader class="${infinispan-cachestore-classname}"
fetchPersistentState="false" ignoreModifications="false"
purgeOnStartup="false">
<async enabled="false"/>
</loader>
</loaders>