Package org.ametys.web.synchronization
Class AbstractSynchronizeObserver
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.web.synchronization.AbstractSynchronizeObserver
-
- All Implemented Interfaces:
Observer
,LogEnabled
,Serviceable
- Direct Known Subclasses:
AbstractSynchronizePageObserver
,InvalidateCacheOnQueryChangesObserver
,SynchronizeACLObserver
,SynchronizeContentAdditionObserver
,SynchronizeContentCommentedObserver
,SynchronizeContentDeletionObserver
,SynchronizeContentPrivacyChangeObserver
,SynchronizeContentReactionObserver
,SynchronizeContentTaggedObserver
,SynchronizeContentUnpublishObserver
,SynchronizeContentValidationObserver
,SynchronizedContentTranslatedObserver
,SynchronizePageAttachmentsObserver
,SynchronizePageDeletionObserver
,SynchronizePageMoveObserver
,SynchronizeRobotsChangeObserver
,SynchronizeSiteChangeObserver
,SynchronizeSitemapAdditionObserver
,SynchronizeSitemapChangeObserver
,SynchronizeSiteMoveObserver
,SynchronizeSiteOrSitemapDeletionObserver
public abstract class AbstractSynchronizeObserver extends AbstractLogEnabled implements Observer, Serviceable
AbstractObserver
for synchronizing the workspace live.A lock is used for write access to the live session in order to prevent errors from a parallel full synchronization or observer.
-
-
Field Summary
Fields Modifier and Type Field Description protected LiveAccessManager
_liveAccessManager
Preview access manager.protected Repository
_repository
JCR repository.protected SynchronizeComponent
_synchronizeComponent
-
Fields inherited from interface org.ametys.core.observation.Observer
MAX_PRIORITY, MIN_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description AbstractSynchronizeObserver()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
_internalObserve(Event event, Session liveSession)
Observes the event with access to the live workspace.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)
-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
_repository
protected Repository _repository
JCR repository.
-
_liveAccessManager
protected LiveAccessManager _liveAccessManager
Preview access manager.
-
_synchronizeComponent
protected SynchronizeComponent _synchronizeComponent
-
-
Constructor Detail
-
AbstractSynchronizeObserver
public AbstractSynchronizeObserver()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
getPriority
public int getPriority(Event event)
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
public void observe(Event event, Map<String,Object> transientVars) throws Exception
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.
-
_internalObserve
protected abstract void _internalObserve(Event event, Session liveSession) throws RepositoryException
Observes the event with access to the live workspace.- Parameters:
event
- the event.liveSession
- the session to the live workspace.- Throws:
RepositoryException
- if an error occurs.
-
-