org.apache.sling.jcr.resource.internal.helper
Class ResourceProviderEntry

java.lang.Object
  extended by org.apache.sling.jcr.resource.internal.helper.ResourceProviderEntry
All Implemented Interfaces:
Comparable<ResourceProviderEntry>
Direct Known Subclasses:
JcrResourceProviderEntry, RootResourceProviderEntry

public class ResourceProviderEntry
extends Object
implements Comparable<ResourceProviderEntry>

The ResourceProviderEntry class represents a node in the tree of resource providers spanned by the root paths of the provider resources.

This class is comparable to itself to help keep the child entries list sorted by their prefix.


Constructor Summary
ResourceProviderEntry(String path, ResourceProvider[] providerList)
          Creates an instance of this class with the given path relative to the parent resource provider entry, encapsulating the given ResourceProvider, and a number of inital child entries.
 
Method Summary
 boolean addResourceProvider(String prefix, ResourceProvider provider, Comparable<?> comparable)
          Adds the given resource provider into the tree for the given prefix.
 int compareTo(ResourceProviderEntry o)
           
 boolean containsKey(String key)
           
 ResourceProviderEntry get(String key)
           
 String getResolutionStats()
           
 Resource getResource(ResourceResolver resourceResolver, String path)
          Returns the resource with the given path or null if neither the resource provider of this entry nor the resource provider of any of the child entries can provide the resource.
 ResourceProvider[] getResourceProviders()
          Returns the resource provider contained in this entry
 void put(String key, ResourceProviderEntry value)
           
 boolean removeResourceProvider(String prefix, ResourceProvider resourceProvider, Comparable<?> comparable)
           
 String toString()
          
 Collection<ResourceProviderEntry> values()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ResourceProviderEntry

public ResourceProviderEntry(String path,
                             ResourceProvider[] providerList)
Creates an instance of this class with the given path relative to the parent resource provider entry, encapsulating the given ResourceProvider, and a number of inital child entries.

Parameters:
path - The relative path supported by the provider
providerList - The resource provider to encapsulate by this entry.
Method Detail

getResourceProviders

public ResourceProvider[] getResourceProviders()
Returns the resource provider contained in this entry


getResource

public Resource getResource(ResourceResolver resourceResolver,
                            String path)
Returns the resource with the given path or null if neither the resource provider of this entry nor the resource provider of any of the child entries can provide the resource.

Parameters:
path - The path to the resource to return.
Returns:
The resource for the path or null if no resource can be found.
Throws:
SlingException - if an error occurrs trying to access an existing resource.

addResourceProvider

public boolean addResourceProvider(String prefix,
                                   ResourceProvider provider,
                                   Comparable<?> comparable)
Adds the given resource provider into the tree for the given prefix.

Returns:
true if the provider could be entered into the subtree below this entry. Otherwise false is returned.

put

public void put(String key,
                ResourceProviderEntry value)

containsKey

public boolean containsKey(String key)

get

public ResourceProviderEntry get(String key)

values

public Collection<ResourceProviderEntry> values()

removeResourceProvider

public boolean removeResourceProvider(String prefix,
                                      ResourceProvider resourceProvider,
                                      Comparable<?> comparable)

compareTo

public int compareTo(ResourceProviderEntry o)
Specified by:
compareTo in interface Comparable<ResourceProviderEntry>

getResolutionStats

public String getResolutionStats()

toString

public String toString()

Overrides:
toString in class Object
See Also:
AbstractMap.toString()


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