|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.sling.resourceresolver.impl.tree.ResourceProviderEntry
public class ResourceProviderEntry
The ResourceProviderEntry class represents a node in the tree of
resource providers spanned by the root paths of the provider resources.
That means this class has a map of child ResourceProviderEntries, keyed by the child name and a list of ProviderHandlers that are mapped to the path that this ResourceProviderEntry represents. To locate a list of potential ResourceProviders the path is split into elements and then that list used to walk down the tree of ResourceProviders. eg: for a path /a/b/c/d the list of ProviderHandlers would be accessed by rootProvider.get("a").get("b").get("c").get("d") assuming the final get("d") was not null. If it was, then the list of ProviderHanders would be rootProvider.get("a").get("b").get("c").
This class is comparable to itself to help keep the child entries list sorted by their prefix.
| Constructor Summary | |
|---|---|
ResourceProviderEntry(String path,
ProviderHandler[] 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 initial child entries. |
|
| Method Summary | |
|---|---|
protected boolean |
addResourceProvider(String prefix,
ProviderHandler provider)
Adds the given resource provider into the tree for the given prefix. |
int |
compareTo(ResourceProviderEntry o)
|
boolean |
containsKey(String key)
|
org.apache.sling.api.resource.Resource |
create(ResourceResolverContext ctx,
org.apache.sling.api.resource.ResourceResolver resourceResolver,
String fullPath,
Map<String,Object> properties)
Create a resource |
void |
delete(ResourceResolverContext ctx,
org.apache.sling.api.resource.ResourceResolver resourceResolver,
org.apache.sling.api.resource.Resource resource)
Delete the resource |
ResourceProviderEntry |
get(String key)
|
String |
getPath()
|
org.apache.sling.api.resource.Resource |
getResource(ResourceResolverContext ctx,
org.apache.sling.api.resource.ResourceResolver resourceResolver,
String path,
boolean isResolve)
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. |
org.apache.sling.api.resource.Resource |
getResourceFromProviders(ResourceResolverContext ctx,
org.apache.sling.api.resource.ResourceResolver resourceResolver,
String fullPath)
|
ProviderHandler[] |
getResourceProviders()
Returns the resource providers contained in this entry |
void |
put(String key,
ResourceProviderEntry value)
|
protected boolean |
removeResourceProvider(String prefix,
ProviderHandler resourceProvider)
Remove the given resource provider from the tree |
static String[] |
split(String st)
Split the string by slash. |
String |
toString()
|
Collection<ResourceProviderEntry> |
values()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ResourceProviderEntry(String path,
ProviderHandler[] providerList)
path - The relative path supported by the providerproviderList - The resource provider to encapsulate by this entry.| Method Detail |
|---|
public String getPath()
public ProviderHandler[] getResourceProviders()
public org.apache.sling.api.resource.Resource getResource(ResourceResolverContext ctx,
org.apache.sling.api.resource.ResourceResolver resourceResolver,
String path,
boolean isResolve)
null if neither
the resource provider of this entry nor the resource provider of any of
the child entries can provide the resource.
path - The path to the resource to return.
null if no resource can
be found.
org.apache.sling.api.SlingException - if an error occurrs trying to access an existing resource.
public void put(String key,
ResourceProviderEntry value)
public boolean containsKey(String key)
public ResourceProviderEntry get(String key)
public Collection<ResourceProviderEntry> values()
public int compareTo(ResourceProviderEntry o)
compareTo in interface Comparable<ResourceProviderEntry>Comparable.compareTo(java.lang.Object)
protected boolean addResourceProvider(String prefix,
ProviderHandler provider)
true if the provider could be entered into the
subtree below this entry. Otherwise false is
returned.
protected boolean removeResourceProvider(String prefix,
ProviderHandler resourceProvider)
public org.apache.sling.api.resource.Resource getResourceFromProviders(ResourceResolverContext ctx,
org.apache.sling.api.resource.ResourceResolver resourceResolver,
String fullPath)
public void delete(ResourceResolverContext ctx,
org.apache.sling.api.resource.ResourceResolver resourceResolver,
org.apache.sling.api.resource.Resource resource)
throws org.apache.sling.api.resource.PersistenceException
NullPointerException - if resource is null
UnsupportedOperationException - If deletion is not allowed/possible
org.apache.sling.api.resource.PersistenceException - If deletion fails
public org.apache.sling.api.resource.Resource create(ResourceResolverContext ctx,
org.apache.sling.api.resource.ResourceResolver resourceResolver,
String fullPath,
Map<String,Object> properties)
throws org.apache.sling.api.resource.PersistenceException
UnsupportedOperationException - If creation is not allowed/possible
org.apache.sling.api.resource.PersistenceException - If creation failspublic static String[] split(String st)
st - The string to split
public String toString()
toString in class ObjectAbstractMap.toString()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||