T - - the indexer batch context typepublic interface IndexerBatchContextFactory<T extends IndexerBatchContext>
IndexerBatchContext.
Code creating/destroying contexts should normally use the following pattern:
try
{
final IndexerBatchContext batchContext = indexerBatchContextFactory.createContext(externalIndexOperation, indexerOperation,
facetSearchConfig, indexedType, indexedProperties, items);
// call additional setters on the context object
indexerContextFactory.prepareContext();
// call the setter for the PKs.
indexerBatchContextFactory.initializeContext();
// put your logic here
indexerBatchContextFactory.destroyContext();
}
catch (final IndexerException | ... | RuntimeException e)
{
indexerBatchContextFactory.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 batch context and sets it as 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 batch listeners (see
IndexerBatchListener.beforeBatch(IndexerBatchContext)). |
void |
prepareContext()
Prepares the context and executes the after prepare context listeners (see
ExtendedIndexerBatchListener.afterPrepareContext(IndexerBatchContext)). |
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
ExtendedIndexerBatchListener.afterPrepareContext(IndexerBatchContext)).IndexerException - if an error occurs during the listeners executionvoid initializeContext()
throws IndexerException
IndexerBatchListener.beforeBatch(IndexerBatchContext)).IndexerException - if an error occurs during the listeners executionT getContext()
void destroyContext()
throws IndexerException
IndexerBatchListener.afterBatch(IndexerBatchContext)).IndexerException - if an error occurs during the listeners executionvoid destroyContext(java.lang.Exception exception)
IndexerBatchListener.afterBatchError(IndexerBatchContext)).Copyright © 2018 SAP SE. All Rights Reserved.