Interface ResourceProvider
-
- All Known Subinterfaces:
AttributableResourceProvider,DynamicResourceProvider,ModifyingResourceProvider,QueriableResourceProvider,RefreshableResourceProvider
@ConsumerType @Deprecated public interface ResourceProvider
Deprecated.Use theResourceProviderAPI for providers of resources. Used by theResourceResolverto 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 aResourceProviderFactoryservice can be implemented which upon successful authentication returns a resource provider with the given user credentials.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringOWNS_ROOTSDeprecated.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.StringRESOURCE_TYPE_SYNTHETICDeprecated.The resource type be set on resources returned by thelistChildren(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.StringROOTSDeprecated.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.StringSERVICE_NAMEDeprecated.The service name to use when registering implementations of this interface as services (value is "org.apache.sling.api.resource.ResourceProvider").static java.lang.StringUSE_RESOURCE_ACCESS_SECURITYDeprecated.The name of the service registration property containing the a boolean flag indicating if the ResourceAccessSecurity service should be used for this provider or not.
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description @Nullable ResourcegetResource(@NotNull ResourceResolver resourceResolver, @NotNull java.lang.String path)Deprecated.Returns a resource from this resource provider ornullif the resource provider cannot find it.@Nullable ResourcegetResource(@NotNull ResourceResolver resourceResolver, @NotNull HttpServletRequest request, @NotNull java.lang.String path)Deprecated.since 2.2.0 (and JCR Resource 2.1.0), this method will not be invoked.@Nullable java.util.Iterator<Resource>listChildren(@NotNull Resource parent)Deprecated.
-
-
-
Field Detail
-
SERVICE_NAME
static final java.lang.String SERVICE_NAME
Deprecated.The service name to use when registering implementations of this interface as services (value is "org.apache.sling.api.resource.ResourceProvider").
-
ROOTS
static final java.lang.String ROOTS
Deprecated.The name of the service registration property containing the root paths of the resources provided by this provider (value is "provider.roots").- See Also:
- Constant Field Values
-
OWNS_ROOTS
static final java.lang.String OWNS_ROOTS
Deprecated.The name of the service registration property containing the a boolean flag whether this provider owns the tree registered by the roots. The default for this value isfalse. 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").- Since:
- 2.2 (Sling API Bundle 2.2.0)
- See Also:
- Constant Field Values
-
USE_RESOURCE_ACCESS_SECURITY
static final java.lang.String USE_RESOURCE_ACCESS_SECURITY
Deprecated.The name of the service registration property containing the a boolean flag indicating if the ResourceAccessSecurity service should be used for this provider or not. ResourceProvider implementations are encouraged to use the ResourceAccessSecurity service for access control unless the underlying storage already provides it. The default for this value isfalse. (value is "provider.useResourceAccessSecurity")- Since:
- 2.4 (Sling API Bundle 2.5.0)
- See Also:
- Constant Field Values
-
RESOURCE_TYPE_SYNTHETIC
static final java.lang.String RESOURCE_TYPE_SYNTHETIC
Deprecated.The resource type be set on resources returned by thelistChildren(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").- See Also:
listChildren(Resource), Constant Field Values
-
-
Method Detail
-
getResource
@Deprecated @Nullable @Nullable Resource getResource(@NotNull @NotNull ResourceResolver resourceResolver, @NotNull @NotNull HttpServletRequest request, @NotNull @NotNull java.lang.String path)
Deprecated.since 2.2.0 (and JCR Resource 2.1.0), this method will not be invoked.Returns a resource from this resource provider ornullif the resource provider cannot find it. The path should have one of theROOTSstrings 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 parameterize the resource resolution. An example of such parameterization is support for a JSR-311 style resource provider to support the parameterized URL patterns.
- Parameters:
resourceResolver- TheResourceResolverto which the returnedResourceis attached.request- The requestpath- The resource path- Returns:
nullIf this provider does not have a resource for the path.- Throws:
SlingException- may be thrown in case of any problem creating theResourceinstance.
-
getResource
@Nullable @Nullable Resource getResource(@NotNull @NotNull ResourceResolver resourceResolver, @NotNull @NotNull java.lang.String path)
Deprecated.Returns a resource from this resource provider ornullif the resource provider cannot find it. The path should have one of theROOTSstrings as its prefix. The resource provider must not return cached instances for a resource as the resource resolver will update the resource metadata of the resource at the end of the resolution process and this metadata might be different depending on the full path of resource resolution passed into the resource resolver.- Parameters:
resourceResolver- TheResourceResolverto which the returnedResourceis attached.path- The full path of the resource.- Returns:
nullIf this provider does not have a resource for the path.- Throws:
SlingException- may be thrown in case of any problem creating theResourceinstance.
-
listChildren
@Nullable @Nullable java.util.Iterator<Resource> listChildren(@NotNull @NotNull Resource parent)
Deprecated.Returns anIteratorofResourceobjects loaded from the children of the givenResource. The returnedResourceinstances are attached to the sameResourceResolveras the givenparentresource.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
SyntheticResourceobjects whose resource type MUST be set toRESOURCE_TYPE_SYNTHETIC. As withgetResource(ResourceResolver, String)the returned Resource objects must not be cached objects.- Parameters:
parent- TheResourcewhose children are requested.- Returns:
- An
IteratorofResourceobjects ornullif the resource provider has no children for the given resource. - Throws:
java.lang.NullPointerException- Ifparentisnull.SlingException- If any error occurs acquiring the child resource iterator.
-
-