@Service(value={MergedResourcePicker2.class,ResourceMergerService.class}) @Property(name="merge.root",value="/mnt/overlay",label="Root",description="The mount point of merged resources") @Property(name="merge.readOnly",boolValue=true,label="Read Only",description="Specifies if the resources are read-only or can be modified.") public class MergingResourcePicker extends Object implements MergedResourcePicker2, ResourceMergerService
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_ROOT |
MERGE_ROOT, READ_ONLY, TRAVERSE_PARENT
Constructor and Description |
---|
MergingResourcePicker() |
Modifier and Type | Method and Description |
---|---|
protected void |
configure(Map<String,Object> properties) |
org.apache.sling.api.resource.Resource |
getMergedResource(org.apache.sling.api.resource.Resource resource)
Returns a merged resource if the provided resource is from one of the search paths
and the resource is not hidden.
|
String |
getMergedResourcePath(String relativePath)
Returns the absolute path for the provided relative path.
|
String |
getResourcePath(String searchPath,
String mergedResourcePath)
Return a resource path by taking the path of the merged resource, removing
the mount point and replacing it with the search path.
|
boolean |
isMergedResource(org.apache.sling.api.resource.Resource resource)
Returns
true if the provided Resource is a merged resource. |
List<org.apache.sling.api.resource.Resource> |
pickResources(org.apache.sling.api.resource.ResourceResolver resolver,
String relativePath,
org.apache.sling.api.resource.Resource relatedResource)
Method invoked by the MergingResourceProvider to identify the resources to be merged for a given
relative path.
|
public static final String DEFAULT_ROOT
public List<org.apache.sling.api.resource.Resource> pickResources(org.apache.sling.api.resource.ResourceResolver resolver, String relativePath, org.apache.sling.api.resource.Resource relatedResource)
MergedResourcePicker2
pickResources
in interface MergedResourcePicker2
resolver
- the ResourceResolverrelativePath
- the path relative to the merge rootrelatedResource
- an optional resource which is related to the given path (parent or child)public String getMergedResourcePath(String relativePath)
getMergedResourcePath
in interface ResourceMergerService
relativePath
- The relative pathpublic org.apache.sling.api.resource.Resource getMergedResource(org.apache.sling.api.resource.Resource resource)
null
, null
is returned.getMergedResource
in interface ResourceMergerService
resource
- The resourcenull
public boolean isMergedResource(org.apache.sling.api.resource.Resource resource)
true
if the provided Resource
is a merged resource.
If the resource is null
, false
is returned.isMergedResource
in interface ResourceMergerService
resource
- The resourcetrue
if the provided Resource
is a merged resource.public String getResourcePath(String searchPath, String mergedResourcePath)
getResourcePath
in interface ResourceMergerService
searchPath
- The search path, this is an absolute path ending with a slash
as returned by the resource resolvermergedResourcePath
- An absolute path to a merged resourceCopyright © 2007–2017 The Apache Software Foundation. All rights reserved.