Class 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 mechanisms
    the abstract observer implementation to react on property changes
    • 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 implementation
      protected javax.jcr.Node getContentNode​(javax.jcr.Session session, String path)
      Deprecated.
      determines the target node (the node to perform the change) of one event item
      protected StringFilter getNodePathFilter()
      Deprecated.
      extension hook to determine the handler filter based on the events node path
      protected abstract String getObservedPath()
      Deprecated.
      determines the root path (probably configured) for the observer registration
      protected StringFilter getPropertyPathFilter()
      Deprecated.
      extension hook to determine the handler filter based on the events property path
      protected abstract org.apache.sling.api.resource.ResourceResolver getResolver()
      Deprecated.
      performs the right login and returns the resolver
      protected ResourceFilter getResourceFilter()
      Deprecated.
      extension hook to determine the handler filter based on the found target resource
      protected 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 session
      protected 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 change
      void onEvent​(javax.jcr.observation.EventIterator events)
      Deprecated.
      collects the changed nodes and calls the observers strategy (doOnChange) for each node found
    • Field Detail

      • 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.
    • Constructor Detail

      • AbstractChangeObserver

        public AbstractChangeObserver()
        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 interface javax.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.