org.apache.sling.resourceresolver.impl
Class ResourceResolverImpl

java.lang.Object
  extended by org.apache.sling.api.adapter.SlingAdaptable
      extended by org.apache.sling.resourceresolver.impl.ResourceResolverImpl
All Implemented Interfaces:
org.apache.sling.api.adapter.Adaptable, org.apache.sling.api.resource.ResourceResolver

@Adaptable(adaptableClass=org.apache.sling.api.resource.ResourceResolver.class,
           adapters=@Adapter(value=javax.jcr.Session.class))
public class ResourceResolverImpl
extends org.apache.sling.api.adapter.SlingAdaptable
implements org.apache.sling.api.resource.ResourceResolver


Field Summary
static String PROP_ALIAS
           
static String PROP_REDIRECT_INTERNAL
           
 
Fields inherited from interface org.apache.sling.api.resource.ResourceResolver
PROPERTY_RESOURCE_TYPE, REQUEST_ATTR_WORKSPACE_INFO, USER_IMPERSONATOR
 
Constructor Summary
ResourceResolverImpl(CommonResourceResolverFactoryImpl factory, ResourceResolverContext ctx)
          The resource resolver context.
 
Method Summary
<AdapterType>
AdapterType
adaptTo(Class<AdapterType> type)
           
 org.apache.sling.api.resource.ResourceResolver clone(Map<String,Object> authenticationInfo)
           
 void close()
           
 void commit()
           
 org.apache.sling.api.resource.Resource create(org.apache.sling.api.resource.Resource parent, String name, Map<String,Object> properties)
           
 void delete(org.apache.sling.api.resource.Resource resource)
           
protected  void finalize()
          Calls the close() method to ensure the resolver is properly cleaned up before it is being collected by the garbage collector because it is not referred to any more.
 Iterator<org.apache.sling.api.resource.Resource> findResources(String query, String language)
           
 Object getAttribute(String name)
           
 Iterator<String> getAttributeNames()
           
 Iterable<org.apache.sling.api.resource.Resource> getChildren(org.apache.sling.api.resource.Resource parent)
           
 String getParentResourceType(org.apache.sling.api.resource.Resource resource)
           
 String getParentResourceType(String resourceType)
           
 org.apache.sling.api.resource.Resource getResource(org.apache.sling.api.resource.Resource base, String path)
           
 org.apache.sling.api.resource.Resource getResource(String path)
           
 String[] getSearchPath()
           
 String getUserID()
           
 boolean hasChanges()
           
 boolean hasChildren(org.apache.sling.api.resource.Resource resource)
           
 boolean isLive()
           
 boolean isResourceType(org.apache.sling.api.resource.Resource resource, String resourceType)
           
 Iterator<org.apache.sling.api.resource.Resource> listChildren(org.apache.sling.api.resource.Resource parent)
           
 String map(javax.servlet.http.HttpServletRequest request, String resourcePath)
          full implementation - apply sling:alias from the resource path - apply /etc/map mappings (inkl. config backwards compat) - return absolute uri if possible
 String map(String resourcePath)
          calls map(HttpServletRequest, String) as map(null, resourcePath)
 Iterator<Map<String,Object>> queryResources(String query, String language)
           
 void refresh()
           
 org.apache.sling.api.resource.Resource resolve(javax.servlet.http.HttpServletRequest request)
           
 org.apache.sling.api.resource.Resource resolve(javax.servlet.http.HttpServletRequest request, String absPath)
           
 org.apache.sling.api.resource.Resource resolve(String absPath)
           
 void revert()
           
 
Methods inherited from class org.apache.sling.api.adapter.SlingAdaptable
setAdapterManager, unsetAdapterManager
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_REDIRECT_INTERNAL

public static final String PROP_REDIRECT_INTERNAL
See Also:
Constant Field Values

PROP_ALIAS

public static final String PROP_ALIAS
See Also:
Constant Field Values
Constructor Detail

ResourceResolverImpl

public ResourceResolverImpl(CommonResourceResolverFactoryImpl factory,
                            ResourceResolverContext ctx)
The resource resolver context.

Method Detail

clone

public org.apache.sling.api.resource.ResourceResolver clone(Map<String,Object> authenticationInfo)
                                                     throws org.apache.sling.api.resource.LoginException
Specified by:
clone in interface org.apache.sling.api.resource.ResourceResolver
Throws:
org.apache.sling.api.resource.LoginException
See Also:
ResourceResolver.clone(Map)

isLive

public boolean isLive()
Specified by:
isLive in interface org.apache.sling.api.resource.ResourceResolver
See Also:
ResourceResolver.isLive()

close

public void close()
Specified by:
close in interface org.apache.sling.api.resource.ResourceResolver
See Also:
ResourceResolver.close()

finalize

protected void finalize()
                 throws Throwable
Calls the close() method to ensure the resolver is properly cleaned up before it is being collected by the garbage collector because it is not referred to any more.

Overrides:
finalize in class Object
Throws:
Throwable

getAttributeNames

public Iterator<String> getAttributeNames()
Specified by:
getAttributeNames in interface org.apache.sling.api.resource.ResourceResolver
See Also:
ResourceResolver.getAttributeNames()

getAttribute

public Object getAttribute(String name)
Specified by:
getAttribute in interface org.apache.sling.api.resource.ResourceResolver
See Also:
ResourceResolver.getAttribute(String)

resolve

public org.apache.sling.api.resource.Resource resolve(String absPath)
Specified by:
resolve in interface org.apache.sling.api.resource.ResourceResolver
See Also:
ResourceResolver.resolve(java.lang.String)

resolve

public org.apache.sling.api.resource.Resource resolve(javax.servlet.http.HttpServletRequest request)
Specified by:
resolve in interface org.apache.sling.api.resource.ResourceResolver
See Also:
ResourceResolver.resolve(javax.servlet.http.HttpServletRequest)

resolve

public org.apache.sling.api.resource.Resource resolve(javax.servlet.http.HttpServletRequest request,
                                                      String absPath)
Specified by:
resolve in interface org.apache.sling.api.resource.ResourceResolver
See Also:
ResourceResolver.resolve(javax.servlet.http.HttpServletRequest, java.lang.String)

map

public String map(String resourcePath)
calls map(HttpServletRequest, String) as map(null, resourcePath)

Specified by:
map in interface org.apache.sling.api.resource.ResourceResolver
See Also:
ResourceResolver.map(java.lang.String)

map

public String map(javax.servlet.http.HttpServletRequest request,
                  String resourcePath)
full implementation - apply sling:alias from the resource path - apply /etc/map mappings (inkl. config backwards compat) - return absolute uri if possible

Specified by:
map in interface org.apache.sling.api.resource.ResourceResolver
See Also:
ResourceResolver.map(javax.servlet.http.HttpServletRequest, java.lang.String)

getSearchPath

public String[] getSearchPath()
Specified by:
getSearchPath in interface org.apache.sling.api.resource.ResourceResolver
See Also:
ResourceResolver.getSearchPath()

getResource

public org.apache.sling.api.resource.Resource getResource(String path)
Specified by:
getResource in interface org.apache.sling.api.resource.ResourceResolver
See Also:
ResourceResolver.getResource(java.lang.String)

getResource

public org.apache.sling.api.resource.Resource getResource(org.apache.sling.api.resource.Resource base,
                                                          String path)
Specified by:
getResource in interface org.apache.sling.api.resource.ResourceResolver
See Also:
ResourceResolver.getResource(org.apache.sling.api.resource.Resource, java.lang.String)

listChildren

public Iterator<org.apache.sling.api.resource.Resource> listChildren(org.apache.sling.api.resource.Resource parent)
Specified by:
listChildren in interface org.apache.sling.api.resource.ResourceResolver
See Also:
ResourceResolver.listChildren(org.apache.sling.api.resource.Resource)

getChildren

public Iterable<org.apache.sling.api.resource.Resource> getChildren(org.apache.sling.api.resource.Resource parent)
Specified by:
getChildren in interface org.apache.sling.api.resource.ResourceResolver
See Also:
Resource.getChildren()

findResources

public Iterator<org.apache.sling.api.resource.Resource> findResources(String query,
                                                                      String language)
                                                               throws org.apache.sling.api.SlingException
Specified by:
findResources in interface org.apache.sling.api.resource.ResourceResolver
Throws:
org.apache.sling.api.SlingException
See Also:
ResourceResolver.findResources(java.lang.String, java.lang.String)

queryResources

public Iterator<Map<String,Object>> queryResources(String query,
                                                   String language)
                                            throws org.apache.sling.api.SlingException
Specified by:
queryResources in interface org.apache.sling.api.resource.ResourceResolver
Throws:
org.apache.sling.api.SlingException
See Also:
ResourceResolver.queryResources(java.lang.String, java.lang.String)

getUserID

public String getUserID()
Specified by:
getUserID in interface org.apache.sling.api.resource.ResourceResolver
See Also:
ResourceResolver.getUserID()

adaptTo

public <AdapterType> AdapterType adaptTo(Class<AdapterType> type)
Specified by:
adaptTo in interface org.apache.sling.api.adapter.Adaptable
Overrides:
adaptTo in class org.apache.sling.api.adapter.SlingAdaptable
See Also:
SlingAdaptable.adaptTo(java.lang.Class)

delete

public void delete(org.apache.sling.api.resource.Resource resource)
            throws org.apache.sling.api.resource.PersistenceException
Specified by:
delete in interface org.apache.sling.api.resource.ResourceResolver
Throws:
org.apache.sling.api.resource.PersistenceException
See Also:
ResourceResolver.delete(org.apache.sling.api.resource.Resource)

create

public org.apache.sling.api.resource.Resource create(org.apache.sling.api.resource.Resource parent,
                                                     String name,
                                                     Map<String,Object> properties)
                                              throws org.apache.sling.api.resource.PersistenceException
Specified by:
create in interface org.apache.sling.api.resource.ResourceResolver
Throws:
org.apache.sling.api.resource.PersistenceException
See Also:
ResourceResolver.create(org.apache.sling.api.resource.Resource, java.lang.String, Map)

revert

public void revert()
Specified by:
revert in interface org.apache.sling.api.resource.ResourceResolver
See Also:
ResourceResolver.revert()

commit

public void commit()
            throws org.apache.sling.api.resource.PersistenceException
Specified by:
commit in interface org.apache.sling.api.resource.ResourceResolver
Throws:
org.apache.sling.api.resource.PersistenceException
See Also:
ResourceResolver.commit()

hasChanges

public boolean hasChanges()
Specified by:
hasChanges in interface org.apache.sling.api.resource.ResourceResolver
See Also:
ResourceResolver.hasChanges()

hasChildren

public boolean hasChildren(org.apache.sling.api.resource.Resource resource)
Specified by:
hasChildren in interface org.apache.sling.api.resource.ResourceResolver
See Also:
org.apache.sling.api.resource.ResourceResolver#hasChildren()

getParentResourceType

public String getParentResourceType(org.apache.sling.api.resource.Resource resource)
Specified by:
getParentResourceType in interface org.apache.sling.api.resource.ResourceResolver
See Also:
ResourceResolver.getParentResourceType(org.apache.sling.api.resource.Resource)

getParentResourceType

public String getParentResourceType(String resourceType)
Specified by:
getParentResourceType in interface org.apache.sling.api.resource.ResourceResolver
See Also:
ResourceResolver.getParentResourceType(java.lang.String)

isResourceType

public boolean isResourceType(org.apache.sling.api.resource.Resource resource,
                              String resourceType)
Specified by:
isResourceType in interface org.apache.sling.api.resource.ResourceResolver
See Also:
ResourceResolver.isResourceType(org.apache.sling.api.resource.Resource, java.lang.String)

refresh

public void refresh()
Specified by:
refresh in interface org.apache.sling.api.resource.ResourceResolver
See Also:
ResourceResolver.refresh()


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