org.apache.sling.api.resource
Interface ResourceProviderFactory


public interface ResourceProviderFactory

The ResourceProviderFactory defines the service API to get and create ResourceProviderss dynamically on a per usage base. Instead of sharing a resource provider between resource resolvers, the factory allows to create an own instance of a resource provider per resource resolver. The factory also supports authentication.

If the resource provider is not used anymore and implements the DynamicResourceProvider interface, the close method should be called.

Since:
2.2.0

Field Summary
static java.lang.String PROPERTY_REQUIRED
          A required resource provider factory is accessed directly when a new resource resolver is created.
 
Method Summary
 ResourceProvider getAdministrativeResourceProvider(java.util.Map<java.lang.String,java.lang.Object> authenticationInfo)
          Returns a new ResourceProvider instance with administrative privileges with further configuration taken from the given authenticationInfo map.
 ResourceProvider getResourceProvider(java.util.Map<java.lang.String,java.lang.Object> authenticationInfo)
          Returns a new ResourceProvider instance with further configuration taken from the given authenticationInfo map.
 

Field Detail

PROPERTY_REQUIRED

static final java.lang.String PROPERTY_REQUIRED
A required resource provider factory is accessed directly when a new resource resolver is created. Only if authentication against all required resource provider factories is successful, a resource resolver is created by the resource resolver factory. Boolean service property, default vaule is false

See Also:
Constant Field Values
Method Detail

getResourceProvider

ResourceProvider getResourceProvider(java.util.Map<java.lang.String,java.lang.Object> authenticationInfo)
                                     throws LoginException
Returns a new ResourceProvider instance with further configuration taken from the given authenticationInfo map. Generally this map will contain a user name and password to authenticate.

If the authenticationInfo map is null the ResourceProvider returned will generally not be authenticated and only provide minimal privileges, if any at all.

Parameters:
authenticationInfo - A map of further credential information which may be used by the implementation to parametrize how the resource provider is created. This may be null.
Returns:
A ResourceProvider according to the authenticationInfo.
Throws:
LoginException - If an error occurrs creating the new ResourceProvider with the provided credential data.

getAdministrativeResourceProvider

ResourceProvider getAdministrativeResourceProvider(java.util.Map<java.lang.String,java.lang.Object> authenticationInfo)
                                                   throws LoginException
Returns a new ResourceProvider instance with administrative privileges with further configuration taken from the given authenticationInfo map.

Note, that if the authenticationInfo map contains the ResourceResolverFactory.USER_IMPERSONATION attribute the ResourceProvider returned will only have administrative privileges if the user identified by the property has administrative privileges.

NOTE: This method is intended for use by infrastructure bundles to access the resource tree and provide general services. This method MUST not be used to handle client requests of whatever kinds. To handle client requests a regular authenticated resource provider retrieved through getResourceProvider(Map) must be used.

Parameters:
authenticationInfo - A map of further credential information which may be used by the implementation to parametrize how the resource provider is created. This may be null.
Returns:
A ResourceProvider with administrative privileges unless the ResourceResolverFactory.USER_IMPERSONATION was set in the authenticationInfo.
Throws:
LoginException - If an error occurrs creating the new ResourceResolverFactory with the provided credential data.


Copyright © 2007-2012 The Apache Software Foundation. All Rights Reserved.