|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ResourceProvider
API for providers of resources. Used by the ResourceResolver
to
transparently access resources from different locations such as a JCR
repository (the default) or OSGi bundles.
This interface is intended to be implemented by providers of resource
instances on behalf of the ResourceResolver
. It
is not intended to be used by client applications directly. A resource
provider can either directly implement this service interface, e.g.
when no user authentication is provided (like for bundle resources)
or a ResourceProviderFactory
service can be implemented which
upon successful authentication returns a resource provider with the
given user credentials.
Field Summary | |
---|---|
static java.lang.String |
OWNS_ROOTS
The name of the service registration property containing the a boolean flag whether this provider owns the tree registered by the roots. |
static java.lang.String |
RESOURCE_TYPE_SYNTHETIC
The resource type be set on resources returned by the listChildren(Resource) method to enable traversing the
resource
tree down to a deeply nested provided resource which has no concrete
parent hierarchy (value is"sling:syntheticResourceProviderResource"). |
static java.lang.String |
ROOTS
The name of the service registration property containing the root paths of the resources provided by this provider (value is "provider.roots"). |
static java.lang.String |
SERVICE_NAME
The service name to use when registering implementations of this interface as services (value is "org.apache.sling.api.resource.ResourceProvider"). |
Method Summary | |
---|---|
Resource |
getResource(ResourceResolver resourceResolver,
javax.servlet.http.HttpServletRequest request,
java.lang.String path)
Deprecated. since 2.2.0 (and JCR Resource 2.1.0), this method will not be invoked. |
Resource |
getResource(ResourceResolver resourceResolver,
java.lang.String path)
Returns a resource from this resource provider or null if
the resource provider cannot find it. |
java.util.Iterator<Resource> |
listChildren(Resource parent)
Returns an Iterator of Resource objects loaded from
the children of the given Resource . |
Field Detail |
---|
static final java.lang.String SERVICE_NAME
static final java.lang.String ROOTS
static final java.lang.String OWNS_ROOTS
false
. If a provider owns a root
no other providers are asked for resources under this root if this
provider does not have a resource. (value is "provider.ownsRoots").
static final java.lang.String RESOURCE_TYPE_SYNTHETIC
listChildren(Resource)
method to enable traversing the
resource
tree down to a deeply nested provided resource which has no concrete
parent hierarchy (value is"sling:syntheticResourceProviderResource").
listChildren(Resource)
,
Constant Field ValuesMethod Detail |
---|
@Deprecated Resource getResource(ResourceResolver resourceResolver, javax.servlet.http.HttpServletRequest request, java.lang.String path)
null
if
the resource provider cannot find it. The path should have one of the
ROOTS
strings as its prefix.
This method is called to resolve a resource for the given request. The properties of the request, such as request parameters, may be use to parametrize the resource resolution. An example of such parametrization is support for a JSR-311 style resource provider to support the parametrized URL patterns.
resourceResolver
- The ResourceResolver
to which the returned
Resource
is attached.
null
If this provider does not have a resource for
the path.
SlingException
- may be thrown in case of any problem creating the Resource
instance.Resource getResource(ResourceResolver resourceResolver, java.lang.String path)
null
if
the resource provider cannot find it. The path should have one of the ROOTS
strings as its prefix.
resourceResolver
- The ResourceResolver
to which the returned Resource
is attached.
null
If this provider does not have a resource for
the path.
SlingException
- may be thrown in case of any problem creating the Resource
instance.java.util.Iterator<Resource> listChildren(Resource parent)
Iterator
of Resource
objects loaded from
the children of the given Resource
. The returned Resource
instances
are attached to the same
ResourceResolver
as the given parent
resource.
This method may be called for resource providers whose root path list contains a path such that the resource path is a prefix of the list entry. This allows for the enumeration of deeply nested provided resources for which no actual parent hierarchy exists.
The returned iterator may in turn contain resources which do not actually exist but are required
to traverse the resource
tree. Such resources SHOULD be SyntheticResource
objects whose resource type MUST be set to
RESOURCE_TYPE_SYNTHETIC
.
parent
- The Resource
whose children are requested.
Iterator
of Resource
objects or null
if the resource
provider has no children for the given resource.
java.lang.NullPointerException
- If parent
is null
.
SlingException
- If any error occurs acquiring the child resource iterator.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |