P
- the type of Resource
this implementation of ResourceOrigin produces.public interface ResourceOrigin<P extends Resource>
Modifier and Type | Interface and Description |
---|---|
static class |
ResourceOrigin.ResourceNotFoundException
Thrown when a given path can't be found.
|
Modifier and Type | Method and Description |
---|---|
P |
getByPath(String path)
Retrieves a
Resource object based on the given path. |
String |
getName()
Returns the name of this origin.
|
P |
getRoot()
Returns the
Resource for this origin's declared root. |
boolean |
hasPath(String path) |
ResourceChangeHandlerRegistration |
registerResourceChangeHandler(ResourceChangeHandler changeHandler)
Hook the underlying resource change monitoring mechanism (if any) to a provided
handler . |
void |
traverseWith(ResourceVisitor visitor)
Traverses this ResourceOrigin from the root, according to the given
ResourceVisitor . |
void |
watchForChanges(ResourceVisitor visitor)
Deprecated.
since 5.4.6 - use
registerResourceChangeHandler(ResourceChangeHandler) instead. Current method is less preferable to
be used for resource changes monitoring because ResourceVisitor is not a suitable interface to communicate such changes. E.g. ResourceVisitor
has no API to provide the context of the change (which ResourceOrigin the change has happened at, what was the type of the change etc). Also ResourceVisitor requires
an instance of Resource - it is not usable to communicate deletion of resources. |
String getName()
void traverseWith(ResourceVisitor visitor)
ResourceVisitor
.@Deprecated void watchForChanges(ResourceVisitor visitor)
registerResourceChangeHandler(ResourceChangeHandler)
instead. Current method is less preferable to
be used for resource changes monitoring because ResourceVisitor
is not a suitable interface to communicate such changes. E.g. ResourceVisitor
has no API to provide the context of the change (which ResourceOrigin
the change has happened at, what was the type of the change etc). Also ResourceVisitor
requires
an instance of Resource
- it is not usable to communicate deletion of resources.ResourceVisitor
.ResourceVisitor
,
PredicatedResourceVisitor
ResourceChangeHandlerRegistration registerResourceChangeHandler(ResourceChangeHandler changeHandler)
handler
.ResourceOriginChange
P getByPath(String path)
Resource
object based on the given path. The given path may or may not start with a
leading /, but will always be considered relative to whatever root path this origin uses; for the user of this
class, such paths should thus be considered absolute, depending on the implementation, they may be relative
to some other path. Directory traversal navigation should be prohibited by implementations for security reasons.ResourceOrigin.ResourceNotFoundException
- if the path does not exist in this ResourceOriginboolean hasPath(String path)
Copyright © 2003–2017 Magnolia International Ltd.. All rights reserved.