public abstract class AbstractSolrIndexResourceObserver extends AbstractLogEnabled implements AsyncObserver, Contextualizable, Serviceable
Modifier and Type | Field and Description |
---|---|
protected Context |
_context
The component context.
|
protected AmetysObjectResolver |
_resolver
The AmetysObject resolver.
|
protected SolrIndexer |
_solrIndexer
The Solr indexer.
|
static String |
DISABLE_INDEXING_KEY
Request attribute disabling content indexation when set to
true . |
MAX_PRIORITY, MIN_PRIORITY
Constructor and Description |
---|
AbstractSolrIndexResourceObserver() |
Modifier and Type | Method and Description |
---|---|
protected void |
_index(Event event,
String workspaceName)
Perform the indexation process
|
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. |
protected abstract String[] |
getWorkspacesToIndex()
Get the list of workspace to index
|
protected abstract boolean |
isHandledResource(AmetysObject object)
Returns true if it is a
Resource or ResourceCollection handled by this observer |
void |
observe(Event event,
Map<String,Object> transientVars)
Observes an event.
|
protected abstract void |
onCollectionRenamedOrMoved(ResourceCollection resourceCollection,
String workspaceName)
Method called when a resource collection handled by this observer is renamed or moved.
|
protected abstract void |
onResourceCreated(Resource resource,
String workspaceName)
Method called when a resource handled by this observer is created.
|
protected abstract void |
onResourceUpdated(Resource resource,
String workspaceName)
Method called when a resource handled by this observer is updated, moved or renamed.
|
void |
service(ServiceManager serviceManager) |
boolean |
supports(Event event)
Checks if the event is supported.
|
getLogger, setLogger
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
parallelizable
public static final String DISABLE_INDEXING_KEY
true
.protected SolrIndexer _solrIndexer
protected AmetysObjectResolver _resolver
public AbstractSolrIndexResourceObserver()
public void contextualize(Context context) throws ContextException
contextualize
in interface Contextualizable
ContextException
public void service(ServiceManager serviceManager) throws ServiceException
service
in interface Serviceable
ServiceException
public boolean supports(Event event)
Observer
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 String[] getWorkspacesToIndex()
protected void _index(Event event, String workspaceName) throws IndexingException
event
- The current eventworkspaceName
- The workspace name for the indexationIndexingException
- if an error occurs during indexation.protected abstract boolean isHandledResource(AmetysObject object)
Resource
or ResourceCollection
handled by this observerobject
- The resource or collectionprotected abstract void onResourceCreated(Resource resource, String workspaceName) throws Exception
resource
- The created resourceworkspaceName
- The workspace nameException
- if an error occursprotected abstract void onResourceUpdated(Resource resource, String workspaceName) throws Exception
resource
- The updated resourceworkspaceName
- The workspace nameException
- if an error occursprotected abstract void onCollectionRenamedOrMoved(ResourceCollection resourceCollection, String workspaceName) throws Exception
resourceCollection
- The resource collectionworkspaceName
- The workspace nameException
- if an error occurs