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 class
AbstractChangeObserver.ChangeCollection
Deprecated.the collection to register all changed target resources of the event listprotected class
AbstractChangeObserver.ChangedResource
Deprecated.the collection item for a change to perform
-
Field Summary
Fields Modifier and Type Field Description protected org.osgi.framework.BundleContext
bundleContext
Deprecated.static int
EVENT_TYPES
Deprecated.static String
LOG_DATE_FORMAT
Deprecated.static String
PROP_LAST_MODIFIED_BY
Deprecated.static StringFilter
PROPERTY_PATH_FILTER
Deprecated.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 void
activate(org.osgi.service.component.ComponentContext context)
Deprecated.void
deactivate()
Deprecated.protected abstract void
doOnChange(org.apache.sling.api.resource.ResourceResolver resolver, AbstractChangeObserver.ChangedResource change)
Deprecated.performs the change for the handler implementationprotected javax.jcr.Node
getContentNode(javax.jcr.Session session, String path)
Deprecated.determines the target node (the node to perform the change) of one event itemprotected StringFilter
getNodePathFilter()
Deprecated.extension hook to determine the handler filter based on the events node pathprotected abstract String
getObservedPath()
Deprecated.determines the root path (probably configured) for the observer registrationprotected StringFilter
getPropertyPathFilter()
Deprecated.extension hook to determine the handler filter based on the events property pathprotected abstract org.apache.sling.api.resource.ResourceResolver
getResolver()
Deprecated.performs the right login and returns the resolverprotected ResourceFilter
getResourceFilter()
Deprecated.extension hook to determine the handler filter based on the found target resourceprotected abstract String
getServiceUserId()
Deprecated.returns the user id used by the observer (used to detect self generated events)protected abstract javax.jcr.Session
getSession()
Deprecated.performs the right login and returns the sessionprotected String
getTargetPath(javax.jcr.Node node)
Deprecated.returns 'null' if the target node traversal should ends (extension hook)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.protected boolean
isPropertyEvent(int type)
Deprecated.returns 'trus' if the event is of type 'property change'protected abstract boolean
isTargetNode(javax.jcr.Node node)
Deprecated.returns 'true' if the node is the target node for the changevoid
onEvent(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.PersistenceException
Deprecated.performs the change for the handler implementation- Throws:
javax.jcr.RepositoryException
org.apache.sling.api.resource.PersistenceException
-
isTargetNode
protected abstract boolean isTargetNode(javax.jcr.Node node) throws javax.jcr.RepositoryException
Deprecated.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.LoginException
Deprecated.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.RepositoryException
Deprecated.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:
onEvent
in 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.RepositoryException
Deprecated.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.
-
-