Package org.apache.felix.configurator.impl.json

## Class JSONUtil

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

    public class JSONUtil
    extends Object

### Nested Class Summary

Nested Classes
`static class` `JSONUtil.Report`

### Constructor Summary

Constructors
`JSONUtil()`

### Method Summary

All Methods Static Methods Concrete Methods
`static List<Config>` `createModel​(BinaryManager binaryManager, long bundleId, org.apache.felix.cm.json.io.ConfigurationResource rsrc, Map<String,​Integer> rankingMap, Map<String,​ConfigPolicy> policyMap)` Create the model
`static String` `getResource​(String name, URL url)` Read the contents of a resource, encoded as UTF-8
`static BundleState` `readConfigurationsFromBundle​(BinUtil.ResourceProvider provider, Set<String> paths, JSONUtil.Report report)` Read all configurations from a bundle
`static ConfigurationFile` `readJSON​(BinaryManager binaryManager, String name, URL url, long bundleId, 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 Detail

#### JSONUtil

    public JSONUtil()

### Method Detail

#### readConfigurationsFromBundle

    public static BundleState readConfigurationsFromBundle​(BinUtil.ResourceProvider provider,
                                                           Set<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,
                                             String name,
                                             URL url,
                                             long bundleId,
                                             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 List<Config> createModel​(BinaryManager binaryManager,
                                           long bundleId,
                                           org.apache.felix.cm.json.io.ConfigurationResource rsrc,
                                           Map<String,​Integer> rankingMap,
                                           Map<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 `Config`s

#### getResource

    public static String getResource​(String name,
                                     URL url)
                              throws IOException

Read the contents of a resource, encoded as UTF-8

Parameters:
  `name` - The resource name
  `url` - The resource URL
Returns:
  The contents
Throws:
  `IOException` - If anything goes wrong