Class ConfigUtils

java.lang.Object
io.openems.common.utils.ConfigUtils

public class ConfigUtils extends Object
  • Method Details

    • generateReferenceTargetFilter

      public static String generateReferenceTargetFilter(String pid, 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
    • generateReferenceTargetFilter

      public static String generateReferenceTargetFilter(String pid, boolean forceEnabled, 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 (if 'forceEnabled' is true)
      • 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
      forceEnabled - Allow only target Components that are `enabled=true`
      ids - Component IDs to be filtered for; for empty list, no ids are added to the target filter
      Returns:
      the target filter