org.apache.sling.resourcemerger.impl
Class MergedResourceProviderFactory
java.lang.Object
org.apache.sling.resourcemerger.impl.MergedResourceProviderFactory
- All Implemented Interfaces:
- org.apache.sling.api.resource.ResourceProviderFactory, ResourceMergerService
@Service(value={org.apache.sling.api.resource.ResourceProviderFactory.class,ResourceMergerService.class})
@Properties(value={@Property(name="provider.roots",value="/mnt/overlay",label="Root",description="The mount point of merged resources"),@Property(name="provider.ownsRoots",boolValue=true,propertyPrivate=true)})
public class MergedResourceProviderFactory
- extends Object
- implements org.apache.sling.api.resource.ResourceProviderFactory, ResourceMergerService
Fields inherited from interface org.apache.sling.api.resource.ResourceProviderFactory |
PROPERTY_REQUIRED, SERVICE_BUNDLE |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_ROOT
public static final String DEFAULT_ROOT
- See Also:
- Constant Field Values
MergedResourceProviderFactory
public MergedResourceProviderFactory()
getResourceProvider
public org.apache.sling.api.resource.ResourceProvider getResourceProvider(Map<String,Object> stringObjectMap)
throws org.apache.sling.api.resource.LoginException
-
- Specified by:
getResourceProvider
in interface org.apache.sling.api.resource.ResourceProviderFactory
- Throws:
org.apache.sling.api.resource.LoginException
getAdministrativeResourceProvider
public org.apache.sling.api.resource.ResourceProvider getAdministrativeResourceProvider(Map<String,Object> stringObjectMap)
throws org.apache.sling.api.resource.LoginException
-
- Specified by:
getAdministrativeResourceProvider
in interface org.apache.sling.api.resource.ResourceProviderFactory
- Throws:
org.apache.sling.api.resource.LoginException
getMergedResourcePath
public String getMergedResourcePath(String relativePath)
- Returns the absolute path for the provided relative path.
- Specified by:
getMergedResourcePath
in interface ResourceMergerService
- Parameters:
relativePath
- The relative path
- Returns:
- Returns the merged resource path
getMergedResource
public 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.
If the resource is
null
, null
is returned.
- Specified by:
getMergedResource
in interface ResourceMergerService
- Parameters:
resource
- The resource
- Returns:
- Returns the merged resource or
null
isMergedResource
public boolean isMergedResource(org.apache.sling.api.resource.Resource resource)
- Returns
true
if the provided Resource
is a merged resource.
If the resource is null
, false
is returned.
- Specified by:
isMergedResource
in interface ResourceMergerService
- Parameters:
resource
- The resource
- Returns:
- Returns
true
if the provided Resource
is a merged resource.
getResourcePath
public 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.
For example, if the provided search path is "/apps/" and the merged resource
path is "/mnt/overlay/my/resource", the result will be "/apps/my/resource".
- Specified by:
getResourcePath
in interface ResourceMergerService
- Parameters:
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 resource
- Returns:
- The path to the resource
configure
@Activate
protected void configure(Map<String,Object> properties)
Copyright © 2007-2014 The Apache Software Foundation. All Rights Reserved.