Class ResourceQueueUtils

java.lang.Object
org.apache.sling.distribution.queue.impl.resource.ResourceQueueUtils

public class ResourceQueueUtils extends Object
  • Field Details

  • Constructor Details

    • ResourceQueueUtils

      public ResourceQueueUtils()
  • Method Details

    • 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
    • unescapeId

      public static String unescapeId(String itemId)
    • incrementProcessingAttemptForQueueItem

      public static void incrementProcessingAttemptForQueueItem(org.apache.sling.api.resource.Resource queueItemResource)