Class AuthenticatedResourceProvider

java.lang.Object
org.apache.sling.resourceresolver.impl.providers.stateful.AuthenticatedResourceProvider

public class AuthenticatedResourceProvider extends Object
This AuthenticatedResourceProvider implementation keeps a resource provider and the authentication information (through the ResolveContext). The methods are similar to those of ResourceProvider.
  • Field Details

  • Constructor Details

    • AuthenticatedResourceProvider

      public AuthenticatedResourceProvider(@NotNull @NotNull ResourceProviderHandler providerHandler, boolean useRAS, @NotNull @NotNull org.apache.sling.spi.resource.provider.ResolveContext<Object> resolveContext, @NotNull @NotNull org.apache.sling.resourceresolver.impl.ResourceAccessSecurityTracker tracker)
      Constructor
      Parameters:
      providerHandler - the providerHandler
      useRAS - useRAS
      resolveContext - resolveContext
      tracker - tracker
  • Method Details

    • getResolveContext

      @NotNull public @NotNull org.apache.sling.spi.resource.provider.ResolveContext<Object> getResolveContext()
      Get the resolve context.
      Returns:
      The resolve context
    • refresh

      public void refresh()
      See Also:
      • ResourceProvider.refresh(ResolveContext)
    • isLive

      public boolean isLive()
      Check if the provider is live
      Returns:
      true If live
      See Also:
      • ResourceProvider.isLive(ResolveContext)
    • getParent

      public org.apache.sling.api.resource.Resource getParent(org.apache.sling.api.resource.Resource child)
      Get the parent resource
      Parameters:
      child - The child
      Returns:
      The parent
      See Also:
      • ResourceProvider.getParent(ResolveContext, Resource)
    • getResource

      public org.apache.sling.api.resource.Resource getResource(String path, org.apache.sling.api.resource.Resource parent, Map<String,String> parameters)
      Parameters:
      path - the path
      parent - parent
      parameters - parameters
      Returns:
      the resource
      See Also:
      • ResourceProvider.getResource(ResolveContext, String, ResourceContext, Resource)
    • listChildren

      public Iterator<org.apache.sling.api.resource.Resource> listChildren(org.apache.sling.api.resource.Resource parent)
      Parameters:
      parent - parent
      Returns:
      the iterator
      See Also:
      • ResourceProvider.listChildren(ResolveContext, Resource)
    • getAttributeNames

      public void getAttributeNames(Set<String> attributeNames)
      Parameters:
      attributeNames - attributeNames
      See Also:
      • ResourceProvider.getAttributeNames(ResolveContext)
    • getAttribute

      public Object getAttribute(String name)
      Parameters:
      name - name
      Returns:
      the attribute
      See Also:
      • ResourceProvider.getAttribute(ResolveContext, String)
    • create

      public org.apache.sling.api.resource.Resource create(org.apache.sling.api.resource.ResourceResolver resolver, String path, Map<String,Object> properties) throws org.apache.sling.api.resource.PersistenceException
      Parameters:
      resolver - the resolver
      path - path
      properties - properties
      Returns:
      the resource
      Throws:
      org.apache.sling.api.resource.PersistenceException - in case of problems
      See Also:
      • ResourceProvider.create(ResolveContext, String, Map)
    • orderBefore

      public boolean orderBefore(@NotNull @NotNull org.apache.sling.api.resource.Resource parent, @NotNull @NotNull String name, @Nullable @Nullable String followingSiblingName) throws org.apache.sling.api.resource.PersistenceException
      Parameters:
      parent - parent
      name - name
      followingSiblingName - followingSiblingName
      Returns:
      true if the order was changed, false if the order was correct already before
      Throws:
      org.apache.sling.api.resource.PersistenceException - in case of problems
      See Also:
      • ResourceProvider.orderBefore(ResolveContext, Resource, String, String)
    • delete

      public void delete(org.apache.sling.api.resource.Resource resource) throws org.apache.sling.api.resource.PersistenceException
      Parameters:
      resource - resource
      Throws:
      org.apache.sling.api.resource.PersistenceException - in case of problems
      See Also:
      • ResourceProvider.delete(ResolveContext, Resource)
    • revert

      public void revert()
      See Also:
      • ResourceProvider.revert(ResolveContext)
    • commit

      public void commit() throws org.apache.sling.api.resource.PersistenceException
      Throws:
      org.apache.sling.api.resource.PersistenceException - in case of problems
      See Also:
      • ResourceProvider.commit(ResolveContext)
    • hasChanges

      public boolean hasChanges()
      Returns:
      true if there are transient changes
      See Also:
      • ResourceProvider.hasChanges(ResolveContext)
    • getSupportedLanguages

      public String[] getSupportedLanguages()
      Returns:
      array with the support query languages
      See Also:
      • QueryLanguageProvider.getSupportedLanguages(ResolveContext)
    • findResources

      public Iterator<org.apache.sling.api.resource.Resource> findResources(String query, String language)
      Parameters:
      query - the query
      language - the language of the query
      Returns:
      an iterator covering the found resources
      See Also:
      • QueryLanguageProvider.findResources(ResolveContext, String, String)
    • queryResources

      public Iterator<Map<String,Object>> queryResources(String query, String language)
      Parameters:
      query - the query
      language - the language of the query
      Returns:
      a map with the result
      See Also:
      • QueryLanguageProvider.queryResources(ResolveContext, String, String)
    • adaptTo

      public <AdapterType> AdapterType adaptTo(Class<AdapterType> type)
      Type Parameters:
      AdapterType - the adapter target
      Parameters:
      type - the type to convert to
      Returns:
      the adapter target or {code}null{code} if the adaption failed
      See Also:
      • ResourceProvider.adaptTo(ResolveContext, Class)
    • copy

      public boolean copy(String srcAbsPath, String destAbsPath) throws org.apache.sling.api.resource.PersistenceException
      Parameters:
      srcAbsPath - the absolute source path
      destAbsPath - the absolute target path
      Returns:
      true if the copy succeeded, false otherwise
      Throws:
      org.apache.sling.api.resource.PersistenceException - in case of problems
      See Also:
      • ResourceProvider.copy(ResolveContext, String, String)
    • move

      public boolean move(String srcAbsPath, String destAbsPath) throws org.apache.sling.api.resource.PersistenceException
      Parameters:
      srcAbsPath - the absolute source path
      destAbsPath - the absolute target path
      Returns:
      true if the move succeeded, false otherwise
      Throws:
      org.apache.sling.api.resource.PersistenceException - in case of problems
      See Also:
      • ResourceProvider.move(ResolveContext, String, String)
    • toString

      public String toString()
      Overrides:
      toString in class Object