Class JSONUtil
- java.lang.Object
-
- org.apache.felix.configurator.impl.json.JSONUtil
-
public class JSONUtil extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
JSONUtil.Report
-
Constructor Summary
Constructors Constructor Description JSONUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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 modelstatic String
getResource(String name, URL url)
Read the contents of a resource, encoded as UTF-8static BundleState
readConfigurationsFromBundle(BinUtil.ResourceProvider provider, Set<String> paths, JSONUtil.Report report)
Read all configurations from a bundlestatic ConfigurationFile
readJSON(BinaryManager binaryManager, String name, URL url, long bundleId, String contents, JSONUtil.Report report)
Read a single JSON file
-
-
-
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 providerpaths
- The paths to read fromreport
- 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 managername
- The name of the fileurl
- The url to that file ornull
bundleId
- The bundle id of the bundle containing the filecontents
- The contents of the filereport
- 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 managerbundleId
- The bundle idrsrc
- The map containing the configurationsrankingMap
- The map with ranking informationpolicyMap
- 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 nameurl
- The resource URL- Returns:
- The contents
- Throws:
IOException
- If anything goes wrong
-
-