Package com.composum.sling.core.event
Class AbstractChangeObserver
- java.lang.Object
-
- com.composum.sling.core.event.AbstractChangeObserver
-
- All Implemented Interfaces:
javax.jcr.observation.EventListener
@Deprecated public abstract class AbstractChangeObserver extends Object implements javax.jcr.observation.EventListener
Deprecated.Please prefer to use the Sling mechanisms (ResourceListener) to the JCR mechanismsthe abstract observer implementation to react on property changes
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classAbstractChangeObserver.ChangeCollectionDeprecated.the collection to register all changed target resources of the event listprotected classAbstractChangeObserver.ChangedResourceDeprecated.the collection item for a change to perform
-
Field Summary
Fields Modifier and Type Field Description protected org.osgi.framework.BundleContextbundleContextDeprecated.static intEVENT_TYPESDeprecated.static StringLOG_DATE_FORMATDeprecated.static StringPROP_LAST_MODIFIED_BYDeprecated.static StringFilterPROPERTY_PATH_FILTERDeprecated.ignore 'jcr:..' properties except: 'jcr:title', 'jcr:description', 'jcr:data'
-
Constructor Summary
Constructors Constructor Description AbstractChangeObserver()Deprecated.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidactivate(org.osgi.service.component.ComponentContext context)Deprecated.voiddeactivate()Deprecated.protected abstract voiddoOnChange(org.apache.sling.api.resource.ResourceResolver resolver, AbstractChangeObserver.ChangedResource change)Deprecated.performs the change for the handler implementationprotected javax.jcr.NodegetContentNode(javax.jcr.Session session, String path)Deprecated.determines the target node (the node to perform the change) of one event itemprotected StringFiltergetNodePathFilter()Deprecated.extension hook to determine the handler filter based on the events node pathprotected abstract StringgetObservedPath()Deprecated.determines the root path (probably configured) for the observer registrationprotected StringFiltergetPropertyPathFilter()Deprecated.extension hook to determine the handler filter based on the events property pathprotected abstract org.apache.sling.api.resource.ResourceResolvergetResolver()Deprecated.performs the right login and returns the resolverprotected ResourceFiltergetResourceFilter()Deprecated.extension hook to determine the handler filter based on the found target resourceprotected abstract StringgetServiceUserId()Deprecated.returns the user id used by the observer (used to detect self generated events)protected abstract javax.jcr.SessiongetSession()Deprecated.performs the right login and returns the sessionprotected StringgetTargetPath(javax.jcr.Node node)Deprecated.returns 'null' if the target node traversal should ends (extension hook)protected booleanignoreEvent(javax.jcr.observation.Event event)Deprecated.We avoid processing external events since we can't access all data on these and we avoid duplicated processing.protected booleanisPropertyEvent(int type)Deprecated.returns 'trus' if the event is of type 'property change'protected abstract booleanisTargetNode(javax.jcr.Node node)Deprecated.returns 'true' if the node is the target node for the changevoidonEvent(javax.jcr.observation.EventIterator events)Deprecated.collects the changed nodes and calls the observers strategy (doOnChange) for each node found
-
-
-
Field Detail
-
EVENT_TYPES
public static final int EVENT_TYPES
Deprecated.- See Also:
- Constant Field Values
-
PROP_LAST_MODIFIED_BY
public static final String PROP_LAST_MODIFIED_BY
Deprecated.- See Also:
- Constant Field Values
-
LOG_DATE_FORMAT
public static final String LOG_DATE_FORMAT
Deprecated.- See Also:
- Constant Field Values
-
PROPERTY_PATH_FILTER
public static final StringFilter PROPERTY_PATH_FILTER
Deprecated.ignore 'jcr:..' properties except: 'jcr:title', 'jcr:description', 'jcr:data'
-
bundleContext
protected org.osgi.framework.BundleContext bundleContext
Deprecated.
-
-
Method Detail
-
getServiceUserId
protected abstract String getServiceUserId()
Deprecated.returns the user id used by the observer (used to detect self generated events)
-
getObservedPath
protected abstract String getObservedPath()
Deprecated.determines the root path (probably configured) for the observer registration
-
doOnChange
protected abstract void doOnChange(org.apache.sling.api.resource.ResourceResolver resolver, AbstractChangeObserver.ChangedResource change) throws javax.jcr.RepositoryException, org.apache.sling.api.resource.PersistenceExceptionDeprecated.performs the change for the handler implementation- Throws:
javax.jcr.RepositoryExceptionorg.apache.sling.api.resource.PersistenceException
-
isTargetNode
protected abstract boolean isTargetNode(javax.jcr.Node node) throws javax.jcr.RepositoryExceptionDeprecated.returns 'true' if the node is the target node for the change- Throws:
javax.jcr.RepositoryException
-
getTargetPath
protected String getTargetPath(javax.jcr.Node node) throws javax.jcr.RepositoryException
Deprecated.returns 'null' if the target node traversal should ends (extension hook)- Throws:
javax.jcr.RepositoryException
-
getPropertyPathFilter
protected StringFilter getPropertyPathFilter()
Deprecated.extension hook to determine the handler filter based on the events property path
-
getNodePathFilter
protected StringFilter getNodePathFilter()
Deprecated.extension hook to determine the handler filter based on the events node path
-
getResourceFilter
protected ResourceFilter getResourceFilter()
Deprecated.extension hook to determine the handler filter based on the found target resource
-
getResolver
protected abstract org.apache.sling.api.resource.ResourceResolver getResolver() throws org.apache.sling.api.resource.LoginExceptionDeprecated.performs the right login and returns the resolver- Throws:
org.apache.sling.api.resource.LoginException
-
getSession
protected abstract javax.jcr.Session getSession() throws javax.jcr.RepositoryExceptionDeprecated.performs the right login and returns the session- Throws:
javax.jcr.RepositoryException
-
onEvent
public void onEvent(javax.jcr.observation.EventIterator events)
Deprecated.collects the changed nodes and calls the observers strategy (doOnChange) for each node found- Specified by:
onEventin interfacejavax.jcr.observation.EventListener
-
ignoreEvent
protected boolean ignoreEvent(javax.jcr.observation.Event event)
Deprecated.We avoid processing external events since we can't access all data on these and we avoid duplicated processing.
-
getContentNode
protected javax.jcr.Node getContentNode(javax.jcr.Session session, String path) throws javax.jcr.RepositoryExceptionDeprecated.determines the target node (the node to perform the change) of one event item- Throws:
javax.jcr.RepositoryException
-
isPropertyEvent
protected boolean isPropertyEvent(int type)
Deprecated.returns 'trus' if the event is of type 'property change'
-
activate
public void activate(org.osgi.service.component.ComponentContext context)
Deprecated.
-
deactivate
public void deactivate()
Deprecated.
-
-