Author: skabashnyuk
Date: 2009-11-20 08:45:40 -0500 (Fri, 20 Nov 2009)
New Revision: 790
Added:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerInterceptor.java
Removed:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/cacheloader/
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexInterceptor.java
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryContainer.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/IndexingTree.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SystemSearchManager.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexModificationsBuilder.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerCacheLoader.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheWorkspaceDataContainer.java
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/IndexerCacheLoaderTest.java
Log:
EXOJCR-241 : IndexInterceptor update. Fixed duplication on delete. Code reorganize
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryContainer.java
===================================================================
---
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryContainer.java 2009-11-20
13:04:43 UTC (rev 789)
+++
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryContainer.java 2009-11-20
13:45:40 UTC (rev 790)
@@ -50,7 +50,7 @@
import org.exoplatform.services.jcr.impl.core.query.SearchManager;
import org.exoplatform.services.jcr.impl.core.query.SystemSearchManager;
import org.exoplatform.services.jcr.impl.core.query.SystemSearchManagerHolder;
-import org.exoplatform.services.jcr.impl.core.query.cacheloader.IndexInterceptor;
+import org.exoplatform.services.jcr.impl.core.query.jbosscache.IndexerInterceptor;
import org.exoplatform.services.jcr.impl.core.value.ValueFactoryImpl;
import
org.exoplatform.services.jcr.impl.dataflow.persistent.JBossCacheWorkspaceDataManager;
import
org.exoplatform.services.jcr.impl.dataflow.persistent.LocalWorkspaceDataManagerStub;
@@ -221,7 +221,7 @@
//so IndexerCacheLoader will use it.
//registerComponentInstance(new SearchManagerHolder());
//
workspaceContainer.registerComponentImplementation(SearchManagerHolder.class);
- workspaceContainer.registerComponentImplementation(IndexInterceptor.class);
+
workspaceContainer.registerComponentImplementation(IndexerInterceptor.class);
if (isSystem)
{
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/IndexingTree.java
===================================================================
---
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/IndexingTree.java 2009-11-20
13:04:43 UTC (rev 789)
+++
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/IndexingTree.java 2009-11-20
13:45:40 UTC (rev 790)
@@ -32,87 +32,94 @@
* @version $Id$
*
*/
-public class IndexingTree {
- private final QPath indexingRootQpath;
- private final NodeData indexingRoot;
+public class IndexingTree
+{
+ private final QPath indexingRootQpath;
- private final List<QPath> excludedPaths;
+ private final NodeData indexingRoot;
- /**
- * @param indexingRoot
- * @param excludedPaths
- */
- public IndexingTree(NodeData indexingRoot, List<QPath> excludedPaths) {
- super();
- this.indexingRoot = indexingRoot;
- this.indexingRootQpath = indexingRoot.getQPath();
- this.excludedPaths = excludedPaths;
- }
+ private final List<QPath> excludedPaths;
- /**
- * @param indexingRoot
- * @param excludedPaths
- */
- public IndexingTree(NodeData indexingRoot) {
- super();
- this.indexingRoot = indexingRoot;
- this.indexingRootQpath = indexingRoot.getQPath();
- this.excludedPaths = new ArrayList<QPath>();
- }
+ /**
+ * @param indexingRoot
+ * @param excludedPaths
+ */
+ public IndexingTree(NodeData indexingRoot, List<QPath> excludedPaths)
+ {
+ super();
+ this.indexingRoot = indexingRoot;
+ this.indexingRootQpath = indexingRoot.getQPath();
+ this.excludedPaths = excludedPaths;
+ }
- /**
- * @return the excludedPaths
- */
- public List<QPath> getExcludedPaths() {
- return excludedPaths;
- }
+ /**
+ * @param indexingRoot
+ * @param excludedPaths
+ */
+ public IndexingTree(NodeData indexingRoot)
+ {
+ super();
+ this.indexingRoot = indexingRoot;
+ this.indexingRootQpath = indexingRoot.getQPath();
+ this.excludedPaths = new ArrayList<QPath>();
+ }
- /**
- * @return the indexingRoot
- */
- public NodeData getIndexingRoot() {
- return indexingRoot;
- }
+ /**
+ * @return the excludedPaths
+ */
+ public List<QPath> getExcludedPaths()
+ {
+ return excludedPaths;
+ }
- /**
- * Checks if the given event should be excluded based on the
- * {@link #excludePath} setting.
- *
- * @param event
- * observation event
- * @return <code>true</code> if the event should be excluded,
- * <code>false</code> otherwise
- */
- public boolean isExcluded(ItemState event) {
+ /**
+ * @return the indexingRoot
+ */
+ public NodeData getIndexingRoot()
+ {
+ return indexingRoot;
+ }
- for (QPath excludedPath : excludedPaths) {
- if (event.getData().getQPath().isDescendantOf(excludedPath)
- || event.getData().getQPath().equals(excludedPath))
- return true;
- }
+ /**
+ * Checks if the given event should be excluded based on the
+ * {@link #excludePath} setting.
+ *
+ * @param event
+ * observation event
+ * @return <code>true</code> if the event should be excluded,
+ * <code>false</code> otherwise
+ */
+ public boolean isExcluded(ItemState event)
+ {
- return !event.getData().getQPath().isDescendantOf(indexingRootQpath)
- && !event.getData().getQPath().equals(indexingRootQpath);
- }
+ for (QPath excludedPath : excludedPaths)
+ {
+ if (event.getData().getQPath().isDescendantOf(excludedPath) ||
event.getData().getQPath().equals(excludedPath))
+ return true;
+ }
- /**
- * Checks if the given event should be excluded based on the
- * {@link #excludePath} setting.
- *
- * @param event
- * observation event
- * @return <code>true</code> if the event should be excluded,
- * <code>false</code> otherwise
- */
- public boolean isExcluded(ItemData eventData) {
+ return !event.getData().getQPath().isDescendantOf(indexingRootQpath)
+ && !event.getData().getQPath().equals(indexingRootQpath);
+ }
- for (QPath excludedPath : excludedPaths) {
- if (eventData.getQPath().isDescendantOf(excludedPath)
- || eventData.getQPath().equals(excludedPath))
- return true;
- }
+ /**
+ * Checks if the given event should be excluded based on the
+ * {@link #excludePath} setting.
+ *
+ * @param event
+ * observation event
+ * @return <code>true</code> if the event should be excluded,
+ * <code>false</code> otherwise
+ */
+ public boolean isExcluded(ItemData eventData)
+ {
- return !eventData.getQPath().isDescendantOf(indexingRootQpath)
- && !eventData.getQPath().equals(indexingRootQpath);
- }
+ for (QPath excludedPath : excludedPaths)
+ {
+ if (eventData.getQPath().isDescendantOf(excludedPath) ||
eventData.getQPath().equals(excludedPath))
+ return true;
+ }
+
+ return !eventData.getQPath().isDescendantOf(indexingRootQpath) &&
!eventData.getQPath().equals(indexingRootQpath);
+ }
}
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java
===================================================================
---
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java 2009-11-20
13:04:43 UTC (rev 789)
+++
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java 2009-11-20
13:45:40 UTC (rev 790)
@@ -42,8 +42,8 @@
import org.exoplatform.services.jcr.impl.core.NamespaceRegistryImpl;
import org.exoplatform.services.jcr.impl.core.SessionDataManager;
import org.exoplatform.services.jcr.impl.core.SessionImpl;
-import org.exoplatform.services.jcr.impl.core.query.cacheloader.IndexInterceptor;
-import
org.exoplatform.services.jcr.impl.core.query.cacheloader.IndexModificationsBuilder;
+import
org.exoplatform.services.jcr.impl.core.query.jbosscache.IndexModificationsBuilder;
+import org.exoplatform.services.jcr.impl.core.query.jbosscache.IndexerInterceptor;
import org.exoplatform.services.jcr.impl.core.query.lucene.FieldNames;
import org.exoplatform.services.jcr.impl.core.query.lucene.LuceneVirtualTableResolver;
import org.exoplatform.services.jcr.impl.core.query.lucene.QueryHits;
@@ -168,7 +168,7 @@
public SearchManager(QueryHandlerEntry config, NamespaceRegistryImpl nsReg,
NodeTypeDataManager ntReg,
WorkspacePersistentDataManager itemMgr, SystemSearchManagerHolder
parentSearchManager,
DocumentReaderService extractor, ConfigurationManager cfm,
- final RepositoryIndexSearcherHolder indexSearcherHolder, IndexInterceptor
indexInterceptor)
+ final RepositoryIndexSearcherHolder indexSearcherHolder, IndexerInterceptor
indexInterceptor)
throws RepositoryException, RepositoryConfigurationException
{
@@ -181,8 +181,6 @@
this.cfm = cfm;
this.virtualTableResolver = new LuceneVirtualTableResolver(nodeTypeDataManager,
nsReg);
this.parentSearchManager = parentSearchManager != null ? parentSearchManager.get()
: null;
- //itemMgr.addItemPersistenceListener(this);
- //searchManagerHolder.put(this);
indexInterceptor.addIndexInterceptorListener(this);
}
@@ -432,7 +430,10 @@
if (item != null)
{
if (item.isNode())
- return (NodeData)item; // return node
+ {
+ if (!indexingTree.isExcluded(item))
+ return (NodeData)item;
+ }
else
log.warn("Node not found, but property " + id +
", " + item.getQPath().getAsString()
+ " found. ");
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SystemSearchManager.java
===================================================================
---
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SystemSearchManager.java 2009-11-20
13:04:43 UTC (rev 789)
+++
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SystemSearchManager.java 2009-11-20
13:45:40 UTC (rev 790)
@@ -26,7 +26,7 @@
import org.exoplatform.services.jcr.datamodel.QPath;
import org.exoplatform.services.jcr.impl.Constants;
import org.exoplatform.services.jcr.impl.core.NamespaceRegistryImpl;
-import org.exoplatform.services.jcr.impl.core.query.cacheloader.IndexInterceptor;
+import org.exoplatform.services.jcr.impl.core.query.jbosscache.IndexerInterceptor;
import
org.exoplatform.services.jcr.impl.dataflow.persistent.WorkspacePersistentDataManager;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -65,7 +65,7 @@
public SystemSearchManager(QueryHandlerEntry config, NamespaceRegistryImpl nsReg,
NodeTypeDataManager ntReg,
WorkspacePersistentDataManager itemMgr, DocumentReaderService service,
ConfigurationManager cfm,
- RepositoryIndexSearcherHolder indexSearcherHolder, IndexInterceptor
indexInterceptor) throws RepositoryException,
+ RepositoryIndexSearcherHolder indexSearcherHolder, IndexerInterceptor
indexInterceptor) throws RepositoryException,
RepositoryConfigurationException
{
super(config, nsReg, ntReg, itemMgr, null, service, cfm, indexSearcherHolder,
indexInterceptor);
Copied:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache
(from rev 782,
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/cacheloader)
Deleted:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexInterceptor.java
===================================================================
---
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/cacheloader/IndexInterceptor.java 2009-11-19
16:19:28 UTC (rev 782)
+++
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexInterceptor.java 2009-11-20
13:45:40 UTC (rev 790)
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.impl.core.query.cacheloader;
-
-import org.exoplatform.services.jcr.impl.core.query.SearchManager;
-import org.exoplatform.services.log.ExoLogger;
-import org.exoplatform.services.log.Log;
-import org.jboss.cache.InvocationContext;
-import org.jboss.cache.commands.tx.PrepareCommand;
-import org.jboss.cache.interceptors.base.CommandInterceptor;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author <a href="mailto:Sergey.Kabashnyuk@exoplatform.org">Sergey
Kabashnyuk</a>
- * @version $Id: exo-jboss-codetemplates.xml 34360 2009-07-22 23:58:59Z ksm $
- *
- */
-public class IndexInterceptor extends CommandInterceptor
-{
- private final Log log = ExoLogger.getLogger(IndexInterceptor.class);
-
- /**
- * List of index interceptor listeners.
- */
- private final List<SearchManager> indexInterceptorListners;
-
- /**
- * Default constructor.
- */
- public IndexInterceptor()
- {
- super();
- this.indexInterceptorListners = new ArrayList<SearchManager>();
- }
-
- /**
- * @see
org.jboss.cache.commands.AbstractVisitor#visitPrepareCommand(org.jboss.cache.InvocationContext,
org.jboss.cache.commands.tx.PrepareCommand)
- */
- @Override
- public Object visitPrepareCommand(InvocationContext ctx, PrepareCommand command)
throws Throwable
- {
- // try
- // {
- // if (ctx.getTransactionContext().getModifications().size() > 0)
- // {
- // for (SearchManager searchManager : indexInterceptorListners)
- // {
- //
searchManager.onSaveItems(ctx.getTransactionContext().getModifications());
- // }
- // }
- // }
- // catch (RepositoryException e)
- // {
- // //TODO handle rollback
- // log.error(e.getLocalizedMessage());
- // }
-
- return invokeNextInterceptor(ctx, command);
- }
-
- /**
- * Add new SearchManager to the indexInterceptorListners list.
- * @param searchManager - search manager.
- */
- public void addIndexInterceptorListener(SearchManager searchManager)
- {
- indexInterceptorListners.add(searchManager);
- }
-
- /**
- * Add new SearchManager to the indexInterceptorListners list.
- * @param searchManager - search manager.
- */
- public boolean removeIndexInterceptorListener(SearchManager searchManager)
- {
- return indexInterceptorListners.remove(searchManager);
- }
-}
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexModificationsBuilder.java
===================================================================
---
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/cacheloader/IndexModificationsBuilder.java 2009-11-19
16:19:28 UTC (rev 782)
+++
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexModificationsBuilder.java 2009-11-20
13:45:40 UTC (rev 790)
@@ -16,7 +16,7 @@
* 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.cacheloader;
+package org.exoplatform.services.jcr.impl.core.query.jbosscache;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.impl.storage.jbosscache.JBossCacheStorage;
@@ -53,13 +53,8 @@
public IndexModificationsBuilder(HashSet<String> addedNodes,
HashSet<String> removedNodes,
HashSet<String> updateNodes)
{
- // nodes that need to be removed from the index.
this.removedNodes = removedNodes;
-
- // nodes that need to be added to the index.
this.addedNodes = addedNodes;
-
- // node thst must be updated
this.updateNodes = updateNodes;
}
@@ -95,10 +90,6 @@
//add second
addedNodes.add(parseUUID(command.getTo()));
}
- else
- {
- // this is property - do nothing
- }
}
return null;
}
@@ -117,10 +108,6 @@
String uuid = parseUUID(fqn);
addedNodes.add(uuid);
}
- else
- {
- // this is property - do nothing
- }
}
return null;
}
@@ -179,16 +166,19 @@
{
// add node
String uuid = parseUUID(fqn);
+ updateNodes.remove(uuid);
+ addedNodes.remove(uuid);
removedNodes.add(uuid);
}
- else
- {
- // this is property - do nothing
- }
}
return null;
}
+ /**
+ *
+ * @param fqn
+ * @return true if fqn is the path to the node, false if fqn is the path to the
property.
+ */
private boolean isNode(Fqn<String> fqn)
{
String items = (String)fqn.get(0);
@@ -196,6 +186,11 @@
return s.equals(JBossCacheStorage.NODES);
}
+ /**
+ *
+ * @param fqn
+ * @return Return uuid of item from fqn
+ */
private String parseUUID(Fqn<String> fqn)
{
if (fqn.size() > 1)
@@ -206,10 +201,9 @@
//remove slash
return uuid;
}
- else
- {
- return null;
- }
+
+ return null;
+
}
}
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerCacheLoader.java
===================================================================
---
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/cacheloader/IndexerCacheLoader.java 2009-11-19
16:19:28 UTC (rev 782)
+++
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerCacheLoader.java 2009-11-20
13:45:40 UTC (rev 790)
@@ -14,7 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not,
see<http://www.gnu.org/licenses/>.
*/
-package org.exoplatform.services.jcr.impl.core.query.cacheloader;
+package org.exoplatform.services.jcr.impl.core.query.jbosscache;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import
org.exoplatform.services.jcr.impl.storage.jbosscache.AbstractWriteOnlyCacheLoader;
Added:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerInterceptor.java
===================================================================
---
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerInterceptor.java
(rev 0)
+++
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerInterceptor.java 2009-11-20
13:45:40 UTC (rev 790)
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.exoplatform.services.jcr.impl.core.query.jbosscache;
+
+import org.exoplatform.services.jcr.impl.core.query.SearchManager;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+import org.jboss.cache.InvocationContext;
+import org.jboss.cache.commands.tx.PrepareCommand;
+import org.jboss.cache.commands.tx.RollbackCommand;
+import org.jboss.cache.interceptors.base.CommandInterceptor;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.jcr.RepositoryException;
+
+/**
+ * @author <a href="mailto:Sergey.Kabashnyuk@exoplatform.org">Sergey
Kabashnyuk</a>
+ * @version $Id: exo-jboss-codetemplates.xml 34360 2009-07-22 23:58:59Z ksm $
+ *
+ */
+public class IndexerInterceptor extends CommandInterceptor
+{
+ private final Log log = ExoLogger.getLogger(IndexerInterceptor.class);
+
+ /**
+ * List of index interceptor listeners.
+ */
+ private final List<SearchManager> indexInterceptorListners;
+
+ /**
+ * Default constructor.
+ */
+ public IndexerInterceptor()
+ {
+ super();
+ this.indexInterceptorListners = new ArrayList<SearchManager>();
+ }
+
+ /**
+ * Add new SearchManager to the indexInterceptorListners list.
+ * @param searchManager - search manager.
+ */
+ public void addIndexInterceptorListener(SearchManager searchManager)
+ {
+ indexInterceptorListners.add(searchManager);
+ }
+
+ /**
+ * Add new SearchManager to the indexInterceptorListners list.
+ * @param searchManager - search manager.
+ */
+ public boolean removeIndexInterceptorListener(SearchManager searchManager)
+ {
+ return indexInterceptorListners.remove(searchManager);
+ }
+
+ /**
+ * @see
org.jboss.cache.commands.AbstractVisitor#visitPrepareCommand(org.jboss.cache.InvocationContext,
org.jboss.cache.commands.tx.PrepareCommand)
+ */
+ @Override
+ public Object visitPrepareCommand(InvocationContext ctx, PrepareCommand command)
throws Throwable
+ {
+ try
+ {
+ if (ctx.getTransactionContext().getModifications().size() > 0)
+ {
+ for (SearchManager searchManager : indexInterceptorListners)
+ {
+
searchManager.onSaveItems(ctx.getTransactionContext().getModifications());
+ }
+ }
+ }
+ catch (RepositoryException e)
+ {
+ //TODO handle rollback
+ log.error(e.getLocalizedMessage());
+ }
+
+ return invokeNextInterceptor(ctx, command);
+ }
+
+ /**
+ * @see
org.jboss.cache.commands.AbstractVisitor#visitRollbackCommand(org.jboss.cache.InvocationContext,
org.jboss.cache.commands.tx.RollbackCommand)
+ */
+ @Override
+ public Object visitRollbackCommand(InvocationContext ctx, RollbackCommand command)
throws Throwable
+ {
+ //TODO new feature rollBack
+ return super.visitRollbackCommand(ctx, command);
+ }
+}
Property changes on:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerInterceptor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheWorkspaceDataContainer.java
===================================================================
---
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheWorkspaceDataContainer.java 2009-11-20
13:04:43 UTC (rev 789)
+++
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheWorkspaceDataContainer.java 2009-11-20
13:45:40 UTC (rev 790)
@@ -21,7 +21,7 @@
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
import org.exoplatform.services.jcr.config.RepositoryEntry;
import org.exoplatform.services.jcr.config.WorkspaceEntry;
-import org.exoplatform.services.jcr.impl.core.query.cacheloader.IndexInterceptor;
+import org.exoplatform.services.jcr.impl.core.query.jbosscache.IndexerInterceptor;
import org.exoplatform.services.jcr.impl.storage.WorkspaceDataContainerBase;
import org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer;
import org.exoplatform.services.jcr.storage.WorkspaceDataContainer;
@@ -82,7 +82,7 @@
*/
public JBossCacheWorkspaceDataContainer(WorkspaceEntry wsConfig, RepositoryEntry
repConfig,
InitialContextInitializer contextInit, ValueStoragePluginProvider
valueStorageProvider,
- IndexInterceptor indexInterceptor) throws RepositoryConfigurationException,
NamingException, RepositoryException,
+ IndexerInterceptor indexInterceptor) throws RepositoryConfigurationException,
NamingException, RepositoryException,
IOException
{
this.repositoryName = repConfig.getName();
Modified:
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/IndexerCacheLoaderTest.java
===================================================================
---
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/IndexerCacheLoaderTest.java 2009-11-20
13:04:43 UTC (rev 789)
+++
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/IndexerCacheLoaderTest.java 2009-11-20
13:45:40 UTC (rev 790)
@@ -31,7 +31,7 @@
import org.exoplatform.services.jcr.impl.core.query.QueryHandler;
import org.exoplatform.services.jcr.impl.core.query.RepositoryIndexSearcherHolder;
import org.exoplatform.services.jcr.impl.core.query.SearchManager;
-import org.exoplatform.services.jcr.impl.core.query.cacheloader.IndexerCacheLoader;
+import org.exoplatform.services.jcr.impl.core.query.jbosscache.IndexerCacheLoader;
import org.exoplatform.services.jcr.impl.dataflow.TransientNodeData;
import org.exoplatform.services.jcr.impl.dataflow.TransientPropertyData;
import org.jboss.cache.Modification;