Class ResourceHelper
java.lang.Object
org.apache.sling.discovery.commons.providers.util.ResourceHelper
Some helper methods surrounding resources
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
deleteResource
(ResourceResolver resourceResolver, String path) static Resource
getOrCreateResource
(ResourceResolver resourceResolver, String path) static StringBuilder
getPropertiesForLogging
(Resource resource) Compile a string builder containing the properties of a resource - used for loggingstatic void
moveResource
(Resource res, String path) Move resource to given path.
-
Constructor Details
-
ResourceHelper
public ResourceHelper()
-
-
Method Details
-
getOrCreateResource
public static Resource getOrCreateResource(ResourceResolver resourceResolver, String path) throws PersistenceException - Throws:
PersistenceException
-
deleteResource
public static boolean deleteResource(ResourceResolver resourceResolver, String path) throws PersistenceException - Throws:
PersistenceException
-
getPropertiesForLogging
Compile a string builder containing the properties of a resource - used for logging -
moveResource
Move resource to given path. Try to do it optimized via JCR API. If JCR is not available, fallback to Sling Resource API.- Parameters:
res
- Source resourcepath
- Target path- Throws:
PersistenceException
-