Infinispan Distribution 5.2.6.Final-redhat-2

org.infinispan.query.backend
Class QueryInterceptor

java.lang.Object
  extended by org.infinispan.commands.AbstractVisitor
      extended by org.infinispan.interceptors.base.CommandInterceptor
          extended by org.infinispan.query.backend.QueryInterceptor
All Implemented Interfaces:
Visitor
Direct Known Subclasses:
LocalQueryInterceptor

public class QueryInterceptor
extends CommandInterceptor

This interceptor will be created when the System Property "infinispan.query.indexLocalOnly" is "false"

This type of interceptor will allow the indexing of data even when it comes from other caches within a cluster.

However, if the a cache would not be putting the data locally, the interceptor will not index it.

Since:
4.0
Author:
Navin Surtani, Sanne Grinovero (C) 2011 Red Hat Inc., Marko Luksa

Field Summary
protected  ExecutorService asyncExecutor
           
protected  TransactionManager transactionManager
           
protected  TransactionSynchronizationRegistry transactionSynchronizationRegistry
           
 
Fields inherited from class org.infinispan.interceptors.base.CommandInterceptor
cacheConfiguration
 
Constructor Summary
QueryInterceptor(org.hibernate.search.spi.SearchFactoryIntegrator searchFactory)
           
 
Method Summary
 void enableClasses(Class<?>[] classes)
           
 void enableClasses(Set<Class> knownIndexedTypes)
           
 ExecutorService getAsyncExecutor()
          Use this executor for Async operations
 KeyTransformationHandler getKeyTransformationHandler()
           
protected  Log getLog()
           
 org.hibernate.search.spi.SearchFactoryIntegrator getSearchFactory()
           
 void injectDependencies(TransactionManager transactionManager, TransactionSynchronizationRegistry transactionSynchronizationRegistry, DataContainer dataContainer, ExecutorService e)
           
 void purgeAllIndexes()
          Remove all entries from all known indexes
 void registerKeyTransformer(Class<?> keyClass, Class<? extends Transformer> transformerClass)
           
protected  void removeFromIndexes(Object value, Object key, org.hibernate.search.backend.TransactionContext transactionContext)
           
protected  boolean shouldModifyIndexes(FlagAffectedCommand command, InvocationContext ctx)
           
protected  void updateIndexes(Object value, Object key, org.hibernate.search.backend.TransactionContext transactionContext)
           
 boolean updateKnownTypesIfNeeded(Object value)
           
 Object visitClearCommand(InvocationContext ctx, ClearCommand command)
           
 Object visitPrepareCommand(TxInvocationContext ctx, PrepareCommand command)
          In case of a remotely originating transactions we don't have a chance to visit the single commands but receive this "batch".
 Object visitPutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand command)
           
 Object visitPutMapCommand(InvocationContext ctx, PutMapCommand command)
           
 Object visitRemoveCommand(InvocationContext ctx, RemoveCommand command)
           
 Object visitReplaceCommand(InvocationContext ctx, ReplaceCommand command)
           
 
Methods inherited from class org.infinispan.interceptors.base.CommandInterceptor
getLockAcquisitionTimeout, getNext, handleDefault, hasNext, hasSkipLocking, injectConfiguration, invokeNextInterceptor, setNext
 
Methods inherited from class org.infinispan.commands.AbstractVisitor
visitApplyDeltaCommand, visitCollection, visitCommitCommand, visitDistributedExecuteCommand, visitEntrySetCommand, visitEvictCommand, visitGetKeyValueCommand, visitInvalidateCommand, visitInvalidateL1Command, visitKeySetCommand, visitLockControlCommand, visitRollbackCommand, visitSizeCommand, visitUnknownCommand, visitValuesCommand
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

transactionManager

protected TransactionManager transactionManager

transactionSynchronizationRegistry

protected TransactionSynchronizationRegistry transactionSynchronizationRegistry

asyncExecutor

protected ExecutorService asyncExecutor
Constructor Detail

QueryInterceptor

public QueryInterceptor(org.hibernate.search.spi.SearchFactoryIntegrator searchFactory)
Method Detail

getLog

protected Log getLog()
Overrides:
getLog in class CommandInterceptor

injectDependencies

public void injectDependencies(TransactionManager transactionManager,
                               TransactionSynchronizationRegistry transactionSynchronizationRegistry,
                               DataContainer dataContainer,
                               ExecutorService e)

shouldModifyIndexes

protected boolean shouldModifyIndexes(FlagAffectedCommand command,
                                      InvocationContext ctx)

getAsyncExecutor

public ExecutorService getAsyncExecutor()
Use this executor for Async operations

Returns:

visitPutKeyValueCommand

public Object visitPutKeyValueCommand(InvocationContext ctx,
                                      PutKeyValueCommand command)
                               throws Throwable
Specified by:
visitPutKeyValueCommand in interface Visitor
Overrides:
visitPutKeyValueCommand in class AbstractVisitor
Throws:
Throwable

visitRemoveCommand

public Object visitRemoveCommand(InvocationContext ctx,
                                 RemoveCommand command)
                          throws Throwable
Specified by:
visitRemoveCommand in interface Visitor
Overrides:
visitRemoveCommand in class AbstractVisitor
Throws:
Throwable

visitReplaceCommand

public Object visitReplaceCommand(InvocationContext ctx,
                                  ReplaceCommand command)
                           throws Throwable
Specified by:
visitReplaceCommand in interface Visitor
Overrides:
visitReplaceCommand in class AbstractVisitor
Throws:
Throwable

visitPutMapCommand

public Object visitPutMapCommand(InvocationContext ctx,
                                 PutMapCommand command)
                          throws Throwable
Specified by:
visitPutMapCommand in interface Visitor
Overrides:
visitPutMapCommand in class AbstractVisitor
Throws:
Throwable

visitClearCommand

public Object visitClearCommand(InvocationContext ctx,
                                ClearCommand command)
                         throws Throwable
Specified by:
visitClearCommand in interface Visitor
Overrides:
visitClearCommand in class AbstractVisitor
Throws:
Throwable

purgeAllIndexes

public void purgeAllIndexes()
Remove all entries from all known indexes


removeFromIndexes

protected void removeFromIndexes(Object value,
                                 Object key,
                                 org.hibernate.search.backend.TransactionContext transactionContext)

updateIndexes

protected void updateIndexes(Object value,
                             Object key,
                             org.hibernate.search.backend.TransactionContext transactionContext)

enableClasses

public void enableClasses(Class<?>[] classes)

updateKnownTypesIfNeeded

public boolean updateKnownTypesIfNeeded(Object value)

registerKeyTransformer

public void registerKeyTransformer(Class<?> keyClass,
                                   Class<? extends Transformer> transformerClass)

getKeyTransformationHandler

public KeyTransformationHandler getKeyTransformationHandler()

enableClasses

public void enableClasses(Set<Class> knownIndexedTypes)

getSearchFactory

public org.hibernate.search.spi.SearchFactoryIntegrator getSearchFactory()

visitPrepareCommand

public Object visitPrepareCommand(TxInvocationContext ctx,
                                  PrepareCommand command)
                           throws Throwable
In case of a remotely originating transactions we don't have a chance to visit the single commands but receive this "batch". We then need the before-apply snapshot of some types to route the cleanup commands to the correct indexes. Note we don't need to visit the CommitCommand as the indexing context is registered as a transaction sync.

Specified by:
visitPrepareCommand in interface Visitor
Overrides:
visitPrepareCommand in class AbstractVisitor
Throws:
Throwable

Infinispan Distribution 5.2.6.Final-redhat-2

Copyright © 2013 JBoss, a division of Red Hat. All Rights Reserved.