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
AbstractObserverfor synchronizing the live solr index.
-
-
Field Summary
Fields Modifier and Type Field Description protected Context_contextThe Avalon context.protected AmetysObjectResolver_resolverThe ametys object resolver.protected SolrIndexer_solrIndexerThe Solr indexer.protected SolrPageIndexer_solrPageIndexerThe Solr page indexer.-
Fields inherited from interface org.ametys.core.observation.Observer
MAX_PRIORITY, MIN_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description AbstractLiveSolrObserver()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method 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.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.voidobserve(Event event, Map<String,Object> transientVars)Observes an event.voidservice(ServiceManager manager)-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
_resolver
protected AmetysObjectResolver _resolver
The ametys object resolver.
-
_solrIndexer
protected SolrIndexer _solrIndexer
The Solr indexer.
-
_solrPageIndexer
protected SolrPageIndexer _solrPageIndexer
The Solr page indexer.
-
-
Constructor Detail
-
AbstractLiveSolrObserver
public AbstractLiveSolrObserver()
-
-
Method Detail
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualizein interfaceContextualizable- Throws:
ContextException
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
getPriority
public int getPriority(Event event)
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
public void observe(Event event, Map<String,Object> transientVars) throws Exception
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 Exception
Update 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
protected void _updatePageDocumentsForContent(String contentId) throws Exception
Updates Solr page documents associated with a content.- Parameters:
contentId- the content id.- Throws:
Exception- if an error occurs.
-
_deletePageDocumentsForContent
protected void _deletePageDocumentsForContent(String contentId) throws Exception
Deletes Solr page documents associated with a content.- Parameters:
contentId- the content id.- Throws:
Exception- if an error occurs.
-
_updatePageDocument
protected void _updatePageDocument(String pageId) throws Exception
Updates a Solr document referencing a page.- Parameters:
pageId- the page id.- Throws:
Exception- if an error occurs.
-
_updatePageDocument
protected void _updatePageDocument(String pageId, boolean indexRecursively) throws Exception
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
protected Page _getPageInLive(String pageId)
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.
-
-