public interface IndexerContextFactory<T extends IndexerContext>
IndexerContext.
Code creating/destroying contexts should normally use the following pattern:
try
{
final IndexerContext context = indexerContextFactory.createContext(externalIndexOperation, indexerOperation,
facetSearchConfig, indexedType, indexedProperties, pks);
// call additional setters on the context object
indexerContextFactory.prepareContext();
// call the setter for the PKs.
indexerContextFactory.initializeContext();
// put your logic here
indexerContextFactory.destroyContext();
}
catch (final IndexerException | ... | RuntimeException e)
{
indexerContextFactory.destroyContext(e);
throw e;
}
| Modifier and Type | Method and Description |
|---|---|
T |
createContext(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.
|
void |
destroyContext()
Destroys the current context.
|
void |
destroyContext(java.lang.Exception exception)
Destroys the current context because an exception occurred.
|
T |
getContext()
Returns the current context.
|
void |
initializeContext()
Initializes the current context and executes the before index listeners (see
IndexerListener.beforeIndex(IndexerContext)). |
void |
prepareContext()
Prepares the context and executes the after prepare context listeners (see
ExtendedIndexerListener.afterPrepareContext(IndexerContext)). |
T createContext(long indexOperationId, IndexOperation indexOperation, boolean externalIndexOperation, FacetSearchConfig facetSearchConfig, IndexedType indexedType, java.util.Collection<IndexedProperty> indexedProperties)
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 indexvoid prepareContext()
throws IndexerException
ExtendedIndexerListener.afterPrepareContext(IndexerContext)).IndexerException - if an error occurs during the listeners executionvoid initializeContext()
throws IndexerException
IndexerListener.beforeIndex(IndexerContext)).IndexerException - if an error occurs during the listeners executionT getContext()
void destroyContext()
throws IndexerException
IndexerListener.afterIndex(IndexerContext)).IndexerException - if an error occurs during the listeners executionvoid destroyContext(java.lang.Exception exception)
IndexerListener.afterIndexError(IndexerContext)).Copyright © 2018 SAP SE. All Rights Reserved.