Class AbstractLiveSolrObserver
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.web.indexing.observation.AbstractLiveSolrObserver
- All Implemented Interfaces:
Observer,LogEnabled,Contextualizable,Serviceable
- Direct Known Subclasses:
AbstractTagObserver,SolrContentUnpublishedPart1Observer,SolrContentUnpublishedPart2Observer,SolrLiveContentValidatedOrTaggedObserver,SolrPageMovePart1Observer,SolrPageMovePart2Observer,SolrPageRenameObserver
public abstract class AbstractLiveSolrObserver
extends AbstractLogEnabled
implements Observer, Contextualizable, Serviceable
Abstract
Observer for synchronizing the live solr index.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ContextThe Avalon context.protected AmetysObjectResolverThe ametys object resolver.protected SolrIndexerThe Solr indexer.protected SolrPageIndexerThe Solr page indexer.Fields inherited from interface org.ametys.core.observation.Observer
MAX_PRIORITY, MIN_PRIORITY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected 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.voidcontextualize(Context context) intgetPriority(Event event) Retrieves the priority to observe this event.
This can be used to process a supported event before others observers.voidObserves an event.voidservice(ServiceManager manager) Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
_context
The Avalon context. -
_resolver
The ametys object resolver. -
_solrIndexer
The Solr indexer. -
_solrPageIndexer
The Solr page indexer.
-
-
Constructor Details
-
AbstractLiveSolrObserver
public AbstractLiveSolrObserver()
-
-
Method Details
-
contextualize
- Specified by:
contextualizein interfaceContextualizable- Throws:
ContextException
-
service
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
getPriority
Description copied from interface:ObserverRetrieves the priority to observe this event.
This can be used to process a supported event before others observers.- Specified by:
getPriorityin interfaceObserver- Parameters:
event- the event.- Returns:
- the priority where 0 the max priority and Integer.MAX_VALUE the min priority.
-
observe
Description copied from interface:ObserverObserves an event.- Specified by:
observein interfaceObserver- Parameters:
event- the event.transientVars- transientVars passed from one Observer to another when processing a single Event. This may allow optimizations between observers.- Throws:
Exception- if an error occurs. All exceptions will be logged but not propagated, as the observation mechanism should never fail.
-
_updateIndex
protected abstract void _updateIndex(Event event, Map<String, Object> transientVars) throws ExceptionUpdate the index from the event observed.- Parameters:
event- the event.transientVars- the transient vars passed from one Observer to another when processing a single Event.- Throws:
Exception- if an error occurs.
-
_updatePageDocumentsForContent
Updates Solr page documents associated with a content.- Parameters:
contentId- the content id.- Throws:
Exception- if an error occurs.
-
_deletePageDocumentsForContent
Deletes Solr page documents associated with a content.- Parameters:
contentId- the content id.- Throws:
Exception- if an error occurs.
-
_updatePageDocument
Updates a Solr document referencing a page.- Parameters:
pageId- the page id.- Throws:
Exception- if an error occurs.
-
_updatePageDocument
Updates a Solr document referencing a page.- Parameters:
pageId- the page id.indexRecursively- to also process children pages.- Throws:
Exception- if an error occurs.
-
_getPageInLive
Returns the page in the live workspace corresponding to a given id.- Parameters:
pageId- the page id.- Returns:
- the page in the live workspace or null if not present.
-