Class ResourceHelper

java.lang.Object
org.apache.sling.event.impl.support.ResourceHelper

public abstract class ResourceHelper extends Object
  • Field Details

  • Constructor Details

    • ResourceHelper

      public ResourceHelper()
  • Method Details

    • ignoreProperty

      public static boolean ignoreProperty(String name)
      Check if this property should be ignored
    • filterQueueName

      public static String filterQueueName(String queueName)
      Filter the queue name for not allowed characters and replace them - with the exception of the main queue, which will not be filtered
      Parameters:
      queueName - the suggested queue name
      Returns:
      the filtered queue name
    • filterName

      public static String filterName(String resourceName)
      Filter the node name for not allowed characters and replace them.
      Parameters:
      resourceName - The suggested resource name.
      Returns:
      The filtered node name.
    • cloneValueMap

      public static Map<String,Object> cloneValueMap(org.apache.sling.api.resource.ValueMap vm) throws InstantiationException
      Throws:
      InstantiationException
    • getValueMap

      public static org.apache.sling.api.resource.ValueMap getValueMap(org.apache.sling.api.resource.Resource resource) throws InstantiationException
      Throws:
      InstantiationException
    • getOrCreateBasePath

      public static void getOrCreateBasePath(org.apache.sling.api.resource.ResourceResolver resolver, String path) throws org.apache.sling.api.resource.PersistenceException
      Throws:
      org.apache.sling.api.resource.PersistenceException
    • createAndCommitResource

      public static org.apache.sling.api.resource.Resource createAndCommitResource(org.apache.sling.api.resource.ResourceResolver resolver, String path, Map<String,Object> props) throws org.apache.sling.api.resource.PersistenceException
      Create the resource and commit it
      Parameters:
      resolver - The resource resolver
      path - The path of the resource
      props - The properties
      Returns:
      The created resource
      Throws:
      org.apache.sling.api.resource.PersistenceException - If something goes wrong
    • getOrCreateResource

      public static org.apache.sling.api.resource.Resource getOrCreateResource(org.apache.sling.api.resource.ResourceResolver resolver, String path, Map<String,Object> props) throws org.apache.sling.api.resource.PersistenceException
      Creates or gets the resource at the given path. If any resource along the parent path needs to be created, this is committed immediately. The resource itself is not committed. This is the task of the caller.
      Parameters:
      resolver - The resource resolver to use for creation
      path - The full path to be created
      props - The properties of the new resource.
      Returns:
      The resource for the path.
      Throws:
      org.apache.sling.api.resource.PersistenceException - If something goes wrong