org.apache.sling.api.resource
Interface ResourceResolverFactory

All Known Subinterfaces:
JcrResourceResolverFactory

public interface ResourceResolverFactory

The ResourceResolverFactory defines the service API to get and create ResourceResolvers.

As soon as the resource resolver is not used anymore, ResourceResolver.close() should be called.

Since:
2.1

Field Summary
static String PASSWORD
          Name of the authentication information property providing the password of the user for which to create a resource resolver.
static String USER
          Name of the authentication information property providing the name of the user for which the getResourceResolver(Map) and getAdministrativeResourceResolver(Map) create resource resolvers. on whose behalf the request is being handled.
static String USER_IMPERSONATION
          Name of the authentication information property causing the getResourceResolver(Map) and getAdministrativeResourceResolver(Map) methods to try to impersonate the created resource resolver to the requested user and return the impersonated resource resolver.
 
Method Summary
 ResourceResolver getAdministrativeResourceResolver(Map<String,Object> authenticationInfo)
          Returns a new ResourceResolver instance with administrative privileges with further configuration taken from the given authenticationInfo map.
 ResourceResolver getResourceResolver(Map<String,Object> authenticationInfo)
          Returns a new ResourceResolver instance with further configuration taken from the given authenticationInfo map.
 

Field Detail

USER

static final String USER
Name of the authentication information property providing the name of the user for which the getResourceResolver(Map) and getAdministrativeResourceResolver(Map) create resource resolvers. on whose behalf the request is being handled. This property may be missing in which case an anonymous (unauthenticated) resource resolver is returned if possible.

The type of this property, if present, is String.

See Also:
Constant Field Values

PASSWORD

static final String PASSWORD
Name of the authentication information property providing the password of the user for which to create a resource resolver. If this property is missing an empty password is assumed.

The type of this property, if present, is char[].

See Also:
Constant Field Values

USER_IMPERSONATION

static final String USER_IMPERSONATION
Name of the authentication information property causing the getResourceResolver(Map) and getAdministrativeResourceResolver(Map) methods to try to impersonate the created resource resolver to the requested user and return the impersonated resource resolver.

If this impersonation fails the actual creation of the resource resolver fails.

If this property is not set in the authentication info or is set to the same name as the user.name property this property is ignored.

The type of this property, if present, is String.

See Also:
Constant Field Values
Method Detail

getResourceResolver

ResourceResolver getResourceResolver(Map<String,Object> authenticationInfo)
                                     throws LoginException
Returns a new ResourceResolver 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 ResourceResolver 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 resolver is created. This may be null.
Returns:
A ResourceResolver according to the authenticationInfo.
Throws:
LoginException - If an error occurrs creating the new ResourceResolver with the provided credential data.

getAdministrativeResourceResolver

ResourceResolver getAdministrativeResourceResolver(Map<String,Object> authenticationInfo)
                                                   throws LoginException
Returns a new ResourceResolver instance with administrative privileges with further configuration taken from the given authenticationInfo map.

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

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


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