Class DefaultIndexerBatchContextFactory
- java.lang.Object
-
- de.hybris.platform.solrfacetsearch.indexer.impl.DefaultIndexerBatchContextFactory
-
- All Implemented Interfaces:
IndexerBatchContextFactory<DefaultIndexerBatchContext>
public class DefaultIndexerBatchContextFactory extends java.lang.Object implements IndexerBatchContextFactory<DefaultIndexerBatchContext>
Default implementation ofIndexerBatchContextFactory. It uses a thread local variable for storing the context.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringEXTENDED_LISTENERS_KEYstatic java.lang.StringLISTENERS_KEY
-
Constructor Summary
Constructors Constructor Description DefaultIndexerBatchContextFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DefaultIndexerBatchContextcreateContext(long indexOperationId, IndexOperation indexOperation, boolean externalIndexOperation, FacetSearchConfig facetSearchConfig, IndexedType indexedType, java.util.Collection<IndexedProperty> indexedProperties)Creates a new indexer batch context and sets it as current one.protected voidcreateLocalSessionContext()voiddestroyContext()Destroys the current context.voiddestroyContext(java.lang.Exception failureException)Destroys the current context because an exception occurred.protected voidexecuteAfterBatchErrorListeners(DefaultIndexerBatchContext batchContext)protected voidexecuteAfterBatchListeners(DefaultIndexerBatchContext batchContext)protected voidexecuteAfterPrepareListeners(DefaultIndexerBatchContext context)protected voidexecuteBeforeBatchListeners(DefaultIndexerBatchContext batchContext)DefaultIndexerBatchContextgetContext()Returns the current context.protected java.util.List<ExtendedIndexerBatchListener>getExtendedListeners(DefaultIndexerBatchContext context)protected java.util.List<IndexerBatchListener>getListeners(DefaultIndexerBatchContext batchContext)ListenersFactorygetListenersFactory()SessionServicegetSessionService()voidinitializeContext()Initializes the current context and executes the before batch listeners (seeIndexerBatchListener.beforeBatch(IndexerBatchContext)).voidprepareContext()Prepares the context and executes the after prepare context listeners (seeExtendedIndexerBatchListener.afterPrepareContext(IndexerBatchContext)).protected voidremoveLocalSessionContext()voidsetListenersFactory(ListenersFactory listenersFactory)voidsetSessionService(SessionService sessionService)
-
-
-
Field Detail
-
LISTENERS_KEY
public static final java.lang.String LISTENERS_KEY
- See Also:
- Constant Field Values
-
EXTENDED_LISTENERS_KEY
public static final java.lang.String EXTENDED_LISTENERS_KEY
- See Also:
- Constant Field Values
-
-
Method Detail
-
getSessionService
public SessionService getSessionService()
-
setSessionService
public void setSessionService(SessionService sessionService)
-
getListenersFactory
public ListenersFactory getListenersFactory()
-
setListenersFactory
public void setListenersFactory(ListenersFactory listenersFactory)
-
createContext
public DefaultIndexerBatchContext createContext(long indexOperationId, IndexOperation indexOperation, boolean externalIndexOperation, FacetSearchConfig facetSearchConfig, IndexedType indexedType, java.util.Collection<IndexedProperty> indexedProperties)
Description copied from interface:IndexerBatchContextFactoryCreates a new indexer batch context and sets it as current one.- Specified by:
createContextin interfaceIndexerBatchContextFactory<DefaultIndexerBatchContext>- Parameters:
indexOperationId- - the index operation idindexOperation- - the index operationexternalIndexOperation- - indicates if the index operation is externalfacetSearchConfig- - the facet search configurationindexedType- - the indexed typeindexedProperties- - the properties to index- Returns:
- the new context
-
prepareContext
public void prepareContext() throws IndexerExceptionDescription copied from interface:IndexerBatchContextFactoryPrepares the context and executes the after prepare context listeners (seeExtendedIndexerBatchListener.afterPrepareContext(IndexerBatchContext)).- Specified by:
prepareContextin interfaceIndexerBatchContextFactory<DefaultIndexerBatchContext>- Throws:
IndexerException- if an error occurs during the listeners execution
-
initializeContext
public void initializeContext() throws IndexerExceptionDescription copied from interface:IndexerBatchContextFactoryInitializes the current context and executes the before batch listeners (seeIndexerBatchListener.beforeBatch(IndexerBatchContext)).- Specified by:
initializeContextin interfaceIndexerBatchContextFactory<DefaultIndexerBatchContext>- Throws:
IndexerException- if an error occurs during the listeners execution
-
getContext
public DefaultIndexerBatchContext getContext()
Description copied from interface:IndexerBatchContextFactoryReturns the current context.- Specified by:
getContextin interfaceIndexerBatchContextFactory<DefaultIndexerBatchContext>- Returns:
- the current context
-
destroyContext
public void destroyContext() throws IndexerExceptionDescription copied from interface:IndexerBatchContextFactoryDestroys the current context. Before destroying an active context it executes the after batch listeners (seeIndexerBatchListener.afterBatch(IndexerBatchContext)).- Specified by:
destroyContextin interfaceIndexerBatchContextFactory<DefaultIndexerBatchContext>- Throws:
IndexerException- if an error occurs during the listeners execution
-
destroyContext
public void destroyContext(java.lang.Exception failureException)
Description copied from interface:IndexerBatchContextFactoryDestroys the current context because an exception occurred. Before destroying an active context it executes the after batch error listeners (seeIndexerBatchListener.afterBatchError(IndexerBatchContext)).- Specified by:
destroyContextin interfaceIndexerBatchContextFactory<DefaultIndexerBatchContext>
-
executeAfterPrepareListeners
protected void executeAfterPrepareListeners(DefaultIndexerBatchContext context) throws IndexerException
- Throws:
IndexerException
-
executeBeforeBatchListeners
protected void executeBeforeBatchListeners(DefaultIndexerBatchContext batchContext) throws IndexerException
- Throws:
IndexerException
-
executeAfterBatchListeners
protected void executeAfterBatchListeners(DefaultIndexerBatchContext batchContext) throws IndexerException
- Throws:
IndexerException
-
executeAfterBatchErrorListeners
protected void executeAfterBatchErrorListeners(DefaultIndexerBatchContext batchContext)
-
getExtendedListeners
protected java.util.List<ExtendedIndexerBatchListener> getExtendedListeners(DefaultIndexerBatchContext context)
-
getListeners
protected java.util.List<IndexerBatchListener> getListeners(DefaultIndexerBatchContext batchContext)
-
createLocalSessionContext
protected void createLocalSessionContext()
-
removeLocalSessionContext
protected void removeLocalSessionContext()
-
-