You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by kw...@apache.org on 2017/02/24 07:46:04 UTC

svn commit: r1784233 - /sling/site/trunk/content/documentation/the-sling-engine/resources.mdtext

Author: kwin
Date: Fri Feb 24 07:46:03 2017
New Revision: 1784233

URL: http://svn.apache.org/viewvc?rev=1784233&view=rev
Log:
add information about resource observation

Modified:
    sling/site/trunk/content/documentation/the-sling-engine/resources.mdtext

Modified: sling/site/trunk/content/documentation/the-sling-engine/resources.mdtext
URL: http://svn.apache.org/viewvc/sling/site/trunk/content/documentation/the-sling-engine/resources.mdtext?rev=1784233&r1=1784232&r2=1784233&view=diff
==============================================================================
--- sling/site/trunk/content/documentation/the-sling-engine/resources.mdtext (original)
+++ sling/site/trunk/content/documentation/the-sling-engine/resources.mdtext Fri Feb 24 07:46:03 2017
@@ -147,6 +147,19 @@ The advantage is that this works for any
 See the testSimpleCRUD method in [WriteableResourcesTest][5] for a basic example of how that works.
 More details can be found at [Sling API CRUD Support]({{ refs.sling-api-crud-support.path }}).
 
+## Resource Observation
+
+To be notified whenever certain resources or their properties have been modified/added/removed there are different possibilities
+
+### Resource Observation API (ResourceChangeListener)
+
+*This API is only available since Sling API 2.11.0 ([SLING-4751](https://issues.apache.org/jira/browse/SLING-4751)).*
+Register an OSGi service for [`org.apache.sling.api.resource.observation.ResourceChangeListener`](https://svn.apache.org/repos/asf/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/observation/ResourceChangeListener.java) or `org.apache.sling.api.resource.observation.ExternalResourceChangeListener` to be notified about changes. Certain properties can be used to 
+restrict subscription to only a subset of events.
+
+### OSGi Event Admin
+
+Event are send out via the OSGi Event Admin. You can subscribe to those event by registering an OSGi service for [`org.osgi.service.event.EventHandler`](https://osgi.org/javadoc/r6/cmpn/org/osgi/service/event/EventHandler.html)). Several properties should be used to restrict the subscription to only the relevant event. The event topics which are used for resources are listed as constants in [`org.apache.sling.api.SlingConstants`](http://sling.apache.org/apidocs/sling8/org/apache/sling/api/SlingConstants.html) starting with the prefix `TOPIC_`.
 
 ## Wrap/Decorate Resources