@ConsumerType
public interface ResourceChangeListener
ResourceChangeListener
objects are registered with the Framework service
registry and are notified with ResourceChange
objects when a
change occurs.
ResourceChangeListener
objects can inspect the received ResourceChange
objects to
determine the type of change, location and other properties.
ResourceChangeListener
objects must be registered with a service property
PATHS
whose value is the list of resource paths for which
the listener is interested in getting change events.
By default a resource listener gets only local events which means events
caused by changes persisted on the same instance as this listener is registered.
If the resource listener is interested in external events, the implementation
should implement the ExternalResourceChangeListener
interface, but still register
the service as a ResourceChangeListener
service.
Modifier and Type | Field and Description |
---|---|
static String |
CHANGES
Array of change types - optional.
|
static String |
PATHS
Array of paths or glob patterns - required.
|
Modifier and Type | Method and Description |
---|---|
void |
onChange(List<ResourceChange> changes)
Report resource changes based on the filter properties of this listener.
|
static final 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:
*
character matches zero or more characters of a name component without crossing directory boundaries.**
characters match zero or more characters crossing directory boundaries.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.
static final String CHANGES
ResourceChange.ChangeType
.void onChange(@Nonnull List<ResourceChange> changes)
changes
- The changes.Copyright © 2007–2016 The Apache Software Foundation. All rights reserved.