Class ResourceQueueUtils
- java.lang.Object
-
- org.apache.sling.distribution.queue.impl.resource.ResourceQueueUtils
-
public class ResourceQueueUtils extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static StringRESOURCE_FOLDER
-
Constructor Summary
Constructors Constructor Description ResourceQueueUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.apache.sling.api.resource.ResourcecreateResource(org.apache.sling.api.resource.Resource root, DistributionQueueItem queueItem)static voiddeleteResource(org.apache.sling.api.resource.Resource resource)static org.apache.sling.api.resource.ResourcegetResourceById(org.apache.sling.api.resource.Resource root, String entryId)static intgetResourceCount(org.apache.sling.api.resource.Resource root)static org.apache.sling.api.resource.ResourcegetRootResource(org.apache.sling.api.resource.ResourceResolver resourceResolver, String rootPath)static StringgetTimePath(Calendar now)Transforms current time to path 2018/01/03/23/54static voidincrementProcessingAttemptForQueueItem(org.apache.sling.api.resource.Resource queueItemResource)static booleanisSafeToDelete(String nowPath, String path)Checks if path is safe to delete at this time.static StringunescapeId(String itemId)
-
-
-
Field Detail
-
RESOURCE_FOLDER
public static final String RESOURCE_FOLDER
- See Also:
- Constant Field Values
-
-
Method Detail
-
getRootResource
public static org.apache.sling.api.resource.Resource getRootResource(org.apache.sling.api.resource.ResourceResolver resourceResolver, String rootPath) throws org.apache.sling.api.resource.PersistenceException- Throws:
org.apache.sling.api.resource.PersistenceException
-
getResourceById
public static org.apache.sling.api.resource.Resource getResourceById(org.apache.sling.api.resource.Resource root, String entryId)
-
createResource
public static org.apache.sling.api.resource.Resource createResource(org.apache.sling.api.resource.Resource root, DistributionQueueItem queueItem) throws org.apache.sling.api.resource.PersistenceException- Throws:
org.apache.sling.api.resource.PersistenceException
-
deleteResource
public static void deleteResource(org.apache.sling.api.resource.Resource resource) throws org.apache.sling.api.resource.PersistenceException- Throws:
org.apache.sling.api.resource.PersistenceException
-
getResourceCount
public static int getResourceCount(org.apache.sling.api.resource.Resource root)
-
getTimePath
public static String getTimePath(Calendar now)
Transforms current time to path 2018/01/03/23/54- Parameters:
now- the current time- Returns:
- the serialized time
-
isSafeToDelete
public static boolean isSafeToDelete(String nowPath, String path)
Checks if path is safe to delete at this time. A path is safe to delete if the nowPath does not overlap with it.- Parameters:
nowPath- represents a full path of current time (e.g. 2018/01/03/23/54)path- the path to be checked (it can be a partial path e.g. 2018/01)- Returns:
- true if checked path is in the past
-
incrementProcessingAttemptForQueueItem
public static void incrementProcessingAttemptForQueueItem(org.apache.sling.api.resource.Resource queueItemResource)
-
-