public abstract class AbstractLiveSolrObserver extends AbstractLogEnabled implements Observer, Contextualizable, Serviceable
Observer
for synchronizing the live solr index.Modifier and Type | Field and Description |
---|---|
protected Context |
_context
The Avalon context.
|
protected AmetysObjectResolver |
_resolver
The ametys object resolver.
|
protected SolrIndexer |
_solrIndexer
The Solr indexer.
|
protected SolrPageIndexer |
_solrPageIndexer
The Solr page indexer.
|
MAX_PRIORITY, MIN_PRIORITY
Constructor and Description |
---|
AbstractLiveSolrObserver() |
Modifier and Type | Method and Description |
---|---|
protected void |
_deletePageDocumentsForContent(String contentId)
Deletes Solr page documents associated with a content.
|
protected Page |
_getPageInLive(String pageId)
Returns the page in the live workspace corresponding to a given id.
|
protected abstract void |
_updateIndex(Event event,
Map<String,Object> transientVars)
Update the index from the event observed.
|
protected void |
_updatePageDocument(String pageId)
Updates a Solr document referencing a page.
|
protected void |
_updatePageDocument(String pageId,
boolean indexRecursively)
Updates a Solr document referencing a page.
|
protected void |
_updatePageDocumentsForContent(String contentId)
Updates Solr page documents associated with a content.
|
void |
contextualize(Context context) |
int |
getPriority(Event event)
Retrieves the priority to observe this event.
This can be used to process a supported event before others observers. |
void |
observe(Event event,
Map<String,Object> transientVars)
Observes an event.
|
void |
service(ServiceManager manager) |
getLogger, setLogger
protected AmetysObjectResolver _resolver
protected SolrIndexer _solrIndexer
protected SolrPageIndexer _solrPageIndexer
public AbstractLiveSolrObserver()
public void contextualize(Context context) throws ContextException
contextualize
in interface Contextualizable
ContextException
public void service(ServiceManager manager) throws ServiceException
service
in interface Serviceable
ServiceException
public int getPriority(Event event)
Observer
getPriority
in interface Observer
event
- the event.public void observe(Event event, Map<String,Object> transientVars) throws Exception
Observer
observe
in interface Observer
event
- the event.transientVars
- transientVars passed from one Observer to another when processing a single Event.
This may allow optimizations between observers.Exception
- if an error occurs.
All exceptions will be logged but not propagated, as the observation mechanism should never fail.protected abstract void _updateIndex(Event event, Map<String,Object> transientVars) throws Exception
event
- the event.transientVars
- the transient vars passed from one Observer to another when processing a single Event.Exception
- if an error occurs.protected void _updatePageDocumentsForContent(String contentId) throws Exception
contentId
- the content id.Exception
- if an error occurs.protected void _deletePageDocumentsForContent(String contentId) throws Exception
contentId
- the content id.Exception
- if an error occurs.protected void _updatePageDocument(String pageId) throws Exception
pageId
- the page id.Exception
- if an error occurs.protected void _updatePageDocument(String pageId, boolean indexRecursively) throws Exception
pageId
- the page id.indexRecursively
- to also process children pages.Exception
- if an error occurs.protected Page _getPageInLive(String pageId)
pageId
- the page id.