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
Modifier and TypeFieldDescriptionprotected Context
The Avalon context.protected AmetysObjectResolver
The ametys object resolver.protected SolrIndexer
The Solr indexer.protected SolrPageIndexer
The Solr page indexer.Fields inherited from interface org.ametys.core.observation.Observer
MAX_PRIORITY, MIN_PRIORITY
-
Constructor Summary
-
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.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
Observes an event.void
service
(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:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
getPriority
Description copied from interface:Observer
Retrieves the priority to observe this event.
This can be used to process a supported event before others observers.- Specified by:
getPriority
in 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:Observer
Observes an event.- Specified by:
observe
in 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.
-