Class Utility


  • public abstract class Utility
    extends Object
    • Constructor Detail

      • Utility

        public Utility()
    • Method Detail

      • checkJobTopic

        public static String checkJobTopic​(Object jobTopic)
        Check if the job topic is a valid OSGI event name (see 113.3.1 of the OSGI spec)
        Returns:
        null if the topic is syntactically correct otherwise an error description is returned
      • checkJob

        public static String checkJob​(Object jobTopic,
                                      Map<String,​Object> properties)
        Check the job.
        Returns:
        null if the topic topic is correct and all properties are serializable, otherwise an error description is returned
      • toEvent

        public static org.osgi.service.event.Event toEvent​(org.apache.sling.event.jobs.Job job)
        Create an event from a job
        Parameters:
        job - The job
        Returns:
        New event object.
      • toString

        public static String toString​(String jobTopic,
                                      Map<String,​Object> properties)
        Improved toString method for a job. This method prints out the job topic and all of the properties.
      • toString

        public static String toString​(org.apache.sling.event.jobs.Job job)
        Improved toString method for a job. This method prints out the job topic and all of the properties.
      • readJob

        public static JobImpl readJob​(org.slf4j.Logger logger,
                                      org.apache.sling.api.resource.Resource resource)
        Read a job
      • getSortedChildren

        public static List<org.apache.sling.api.resource.Resource> getSortedChildren​(org.slf4j.Logger logger,
                                                                                     String type,
                                                                                     org.apache.sling.api.resource.Resource rsrc)
        Helper method to read all children of a resource and sort them by name
        Parameters:
        type - The type of resources (for debugging)
        rsrc - The parent resource
        Returns:
        Sorted list of children.