Annotation Type SlingResourceChangeListener
-
@ComponentPropertyType public @interface SlingResourceChangeListener
Component Property Type (as defined by OSGi DS 1.4) for Sling (External)ResourceChangeListener services. Takes care of writing the relevant service properties as being used by the Sling Observation API to register the annotatedResourceChangeListener
DS components with the correct restrictions.- See Also:
ResourceChangeListener
,ExternalResourceChangeListener
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description org.apache.sling.api.resource.observation.ResourceChange.ChangeType[]
change_types
Array of change types - optional.String[]
property_names_hint
An optional hint indicating to the underlying implementation that for changes regarding properties (added/removed/changed) the listener is only interested in those property names listed inhere.
-
-
-
Field Detail
-
PREFIX_
static final String PREFIX_
Prefix for every property being generated from the annotations elements (as defined in OSGi 7 Compendium, 112.8.2.1)
-
-
Element Detail
-
paths
String[] paths
Array of paths or glob patterns - required.
A path is either absolute or relative. If it's a relative path, the relative path will be appended to all search paths of the resource resolver.
If the whole tree of all search paths should be observed, the special value
.
should be used.A glob pattern must start with the
glob:
prefix (e.g.glob:**/*.html
). The following rules are used to interpret glob patterns:- The
*
character matches zero or more characters of a name component without crossing directory boundaries. - The
**
characters match zero or more characters crossing directory boundaries. - If the pattern is relative (does not start with a slash), the relative path will be appended to all search paths of the resource resolver.
In general, it can't be guaranteed that the underlying implementation of the resources will send a remove/add event for each removed/added resource. For example if the root of a tree, like
/foo
is removed, the underlying implementation might only send a single remove event for/foo
but not for any child resources. Similarly for renaming a subtree from/foo
to/bar
the add event may only be sent for/bar
but not for any child resources. Therefore a listener might get remove/add events for resources that not directly match the specified paths/path patterns. For example if a listener is registered for path/foo/bar
and/foo
is removed, the listener will get a remove event for/foo
. The same is true if any pattern is used and any parent of a matching resource is removed/added. The listener must handle these events accordingly.If one of the paths is a sub resource of another specified path, the sub path is ignored.
If this property is missing or invalid, the listener is ignored. The type of the property must either be String, or a String array.
- See Also:
ResourceChangeListener.PATHS
- The
-
-
-
change_types
org.apache.sling.api.resource.observation.ResourceChange.ChangeType[] change_types
Array of change types - optional. If this property is missing, added, removed and changed events for resources and added and removed events for resource providers are reported.- See Also:
ResourceChangeListener.CHANGES
,ResourceChange.ChangeType
- Default:
- {}
-
-
-
property_names_hint
String[] property_names_hint
An optional hint indicating to the underlying implementation that for changes regarding properties (added/removed/changed) the listener is only interested in those property names listed inhere. If the underlying implementation supports this, events for property names that are not enlisted here will not be delivered, however events concerning resources are not affected by this hint. This is only a hint, a change listener registering with this property must be prepared that the underlying implementation is not able to filter based on this property. In this case the listener gets all events as defined with the other properties.This requires Sling API 2.15.0 or newer.
- See Also:
ResourceChangeListener.PROPERTY_NAMES_HINT
- Default:
- {}
-
-