Class ConfigUtils


  • public class ConfigUtils
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String generateReferenceTargetFilter​(java.lang.String pid, java.lang.String... ids)
      Generates a target filter for a Declarative Service @Reference member.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • generateReferenceTargetFilter

        public static java.lang.String generateReferenceTargetFilter​(java.lang.String pid,
                                                                     java.lang.String... ids)
        Generates a target filter for a Declarative Service @Reference member.

        Usage:

         generateReferenceTargetFilter(config.service_pid(), "Controllers", controllersIds);
         

        Generates a 'target' filter on the 'Controllers' member so, that the the expected service to be injected needs to fulfill:

        • the service must be enabled
        • the service must not have the same PID as the calling component
        • the service "id" must be one of the provided "ids"
        Parameters:
        pid - PID of the calling component (use 'config.service_pid()' or '(String)prop.get(Constants.SERVICE_PID)'; if null, PID filter is not added to the resulting target filter
        ids - Component IDs to be filtered for; for empty list, no ids are added to the target filter
        Returns:
        the target filter