Class JSONUtil

java.lang.Object
org.apache.felix.configurator.impl.json.JSONUtil

public class JSONUtil
extends java.lang.Object
  • Nested Class Summary

    Nested Classes 
    Modifier and Type Class Description
    static class  JSONUtil.Report  
  • Constructor Summary

    Constructors 
    Constructor Description
    JSONUtil()  
  • Method Summary

    Modifier and Type Method Description
    static java.util.List<Config> createModel​(BinaryManager binaryManager, long bundleId, org.apache.felix.cm.json.ConfigurationResource rsrc, java.util.Map<java.lang.String,​java.lang.Integer> rankingMap, java.util.Map<java.lang.String,​ConfigPolicy> policyMap)
    Create the model
    static java.lang.String getResource​(java.lang.String name, java.net.URL url)
    Read the contents of a resource, encoded as UTF-8
    static BundleState readConfigurationsFromBundle​(BinUtil.ResourceProvider provider, java.util.Set<java.lang.String> paths, JSONUtil.Report report)
    Read all configurations from a bundle
    static ConfigurationFile readJSON​(BinaryManager binaryManager, java.lang.String name, java.net.URL url, long bundleId, java.lang.String contents, JSONUtil.Report report)
    Read a single JSON file

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • readConfigurationsFromBundle

      public static BundleState readConfigurationsFromBundle​(BinUtil.ResourceProvider provider, java.util.Set<java.lang.String> paths, JSONUtil.Report report)
      Read all configurations from a bundle
      Parameters:
      provider - The bundle provider
      paths - The paths to read from
      report - The report for errors and warnings
      Returns:
      The bundle state.
    • readJSON

      public static ConfigurationFile readJSON​(BinaryManager binaryManager, java.lang.String name, java.net.URL url, long bundleId, java.lang.String contents, JSONUtil.Report report)
      Read a single JSON file
      Parameters:
      binaryManager - The binary manager
      name - The name of the file
      url - The url to that file or null
      bundleId - The bundle id of the bundle containing the file
      contents - The contents of the file
      report - The report for errors and warnings
      Returns:
      The configuration file or null.
    • createModel

      public static java.util.List<Config> createModel​(BinaryManager binaryManager, long bundleId, org.apache.felix.cm.json.ConfigurationResource rsrc, java.util.Map<java.lang.String,​java.lang.Integer> rankingMap, java.util.Map<java.lang.String,​ConfigPolicy> policyMap)
      Create the model
      Parameters:
      binaryManager - The binary manager
      bundleId - The bundle id
      rsrc - The map containing the configurations
      rankingMap - The map with ranking information
      policyMap - The map with policy information
      Returns:
      The list of Configs
    • getResource

      public static java.lang.String getResource​(java.lang.String name, java.net.URL url) throws java.io.IOException
      Read the contents of a resource, encoded as UTF-8
      Parameters:
      name - The resource name
      url - The resource URL
      Returns:
      The contents
      Throws:
      java.io.IOException - If anything goes wrong