Class DefaultIndexerContextFactory
- java.lang.Object
-
- de.hybris.platform.solrfacetsearch.indexer.impl.DefaultIndexerContextFactory
-
- All Implemented Interfaces:
IndexerContextFactory<DefaultIndexerContext>
public class DefaultIndexerContextFactory extends java.lang.Object implements IndexerContextFactory<DefaultIndexerContext>
Default implementation ofIndexerContextFactory. 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 DefaultIndexerContextFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DefaultIndexerContextcreateContext(long indexOperationId, IndexOperation indexOperation, boolean externalIndexOperation, FacetSearchConfig facetSearchConfig, IndexedType indexedType, java.util.Collection<IndexedProperty> indexedProperties)Creates a new indexer context and sets it as the current one.protected voidcreateLocalSessionContext()voiddestroyContext()Destroys the current context.voiddestroyContext(java.lang.Exception failureException)Destroys the current context because an exception occurred.protected voidexecuteAfterIndexErrorListeners(DefaultIndexerContext context)protected voidexecuteAfterIndexListeners(DefaultIndexerContext context)protected voidexecuteAfterPrepareListeners(DefaultIndexerContext context)protected voidexecuteBeforeIndexListeners(DefaultIndexerContext context)DefaultIndexerContextgetContext()Returns the current context.protected java.util.List<ExtendedIndexerListener>getExtendedListeners(DefaultIndexerContext context)protected java.util.List<IndexerListener>getListeners(DefaultIndexerContext context)ListenersFactorygetListenersFactory()SessionServicegetSessionService()voidinitializeContext()Initializes the current context and executes the before index listeners (seeIndexerListener.beforeIndex(IndexerContext)).voidprepareContext()Prepares the context and executes the after prepare context listeners (seeExtendedIndexerListener.afterPrepareContext(IndexerContext)).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 DefaultIndexerContext createContext(long indexOperationId, IndexOperation indexOperation, boolean externalIndexOperation, FacetSearchConfig facetSearchConfig, IndexedType indexedType, java.util.Collection<IndexedProperty> indexedProperties)
Description copied from interface:IndexerContextFactoryCreates a new indexer context and sets it as the current one.- Specified by:
createContextin interfaceIndexerContextFactory<DefaultIndexerContext>- 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:IndexerContextFactoryPrepares the context and executes the after prepare context listeners (seeExtendedIndexerListener.afterPrepareContext(IndexerContext)).- Specified by:
prepareContextin interfaceIndexerContextFactory<DefaultIndexerContext>- Throws:
IndexerException- if an error occurs during the listeners execution
-
initializeContext
public void initializeContext() throws IndexerExceptionDescription copied from interface:IndexerContextFactoryInitializes the current context and executes the before index listeners (seeIndexerListener.beforeIndex(IndexerContext)).- Specified by:
initializeContextin interfaceIndexerContextFactory<DefaultIndexerContext>- Throws:
IndexerException- if an error occurs during the listeners execution
-
getContext
public DefaultIndexerContext getContext()
Description copied from interface:IndexerContextFactoryReturns the current context.- Specified by:
getContextin interfaceIndexerContextFactory<DefaultIndexerContext>- Returns:
- the current context
-
destroyContext
public void destroyContext() throws IndexerExceptionDescription copied from interface:IndexerContextFactoryDestroys the current context. Before destroying an active context it executes the after index listeners (seeIndexerListener.afterIndex(IndexerContext)).- Specified by:
destroyContextin interfaceIndexerContextFactory<DefaultIndexerContext>- Throws:
IndexerException- if an error occurs during the listeners execution
-
destroyContext
public void destroyContext(java.lang.Exception failureException)
Description copied from interface:IndexerContextFactoryDestroys the current context because an exception occurred. Before destroying an active context it executes the after index error listeners (seeIndexerListener.afterIndexError(IndexerContext)).- Specified by:
destroyContextin interfaceIndexerContextFactory<DefaultIndexerContext>
-
executeAfterPrepareListeners
protected void executeAfterPrepareListeners(DefaultIndexerContext context) throws IndexerException
- Throws:
IndexerException
-
executeBeforeIndexListeners
protected void executeBeforeIndexListeners(DefaultIndexerContext context) throws IndexerException
- Throws:
IndexerException
-
executeAfterIndexListeners
protected void executeAfterIndexListeners(DefaultIndexerContext context) throws IndexerException
- Throws:
IndexerException
-
executeAfterIndexErrorListeners
protected void executeAfterIndexErrorListeners(DefaultIndexerContext context)
-
getExtendedListeners
protected java.util.List<ExtendedIndexerListener> getExtendedListeners(DefaultIndexerContext context)
-
getListeners
protected java.util.List<IndexerListener> getListeners(DefaultIndexerContext context)
-
createLocalSessionContext
protected void createLocalSessionContext()
-
removeLocalSessionContext
protected void removeLocalSessionContext()
-
-