public class FeatureJSONReader extends Object
Feature
using a Reader
instance.Modifier and Type | Field and Description |
---|---|
protected String |
exceptionPrefix
Exception prefix containing the location (if set)
|
protected org.apache.sling.feature.Feature |
feature
The read feature.
|
protected String |
location
The optional location.
|
Modifier | Constructor and Description |
---|---|
protected |
FeatureJSONReader(String location)
Private constructor
|
Modifier and Type | Method and Description |
---|---|
protected void |
addConfigurations(Map<String,Object> map,
org.apache.sling.feature.Artifact artifact,
org.apache.sling.feature.Configurations container) |
protected void |
checkType(String key,
Object val,
Class<?>... types)
Check if the value is one of the provided types
|
protected org.apache.sling.feature.ArtifactId |
getFeatureId(Map<String,Object> map) |
protected Map<String,Object> |
getJsonMap(javax.json.JsonObject json)
Get the JSON object as a map, removing all comments that start with a '#' character
|
protected String |
getProperty(Map<String,Object> map,
String key) |
protected String |
minify(Reader reader) |
static org.apache.sling.feature.Feature |
read(Reader reader,
String location)
Read a new feature from the reader
The reader is not closed.
|
protected void |
readArtifacts(String section,
String artifactType,
List<org.apache.sling.feature.Artifact> artifacts,
Object listObj,
org.apache.sling.feature.Configurations container) |
protected void |
readBundles(Map<String,Object> map,
org.apache.sling.feature.Bundles container,
org.apache.sling.feature.Configurations configContainer)
Read the bundles / start levels section
|
protected void |
readCapabilities(Map<String,Object> map,
List<org.osgi.resource.Capability> container) |
protected void |
readConfigurations(Map<String,Object> map,
org.apache.sling.feature.Configurations container) |
protected void |
readExtensions(Map<String,Object> map,
List<String> keywords,
org.apache.sling.feature.Extensions container,
org.apache.sling.feature.Configurations configContainer) |
protected org.apache.sling.feature.Feature |
readFeature(Reader reader)
Read a full feature
|
protected void |
readFrameworkProperties(Map<String,Object> map,
Map<String,String> container) |
protected org.apache.sling.feature.Prototype |
readPrototype(Map<String,Object> map) |
protected void |
readRequirements(Map<String,Object> map,
List<org.apache.sling.feature.MatchingRequirement> container) |
protected Map<String,String> |
readVariables(Map<String,Object> map,
Map<String,String> kvMap)
Read the variables section
|
protected org.apache.sling.feature.Feature feature
protected final String location
protected final String exceptionPrefix
protected FeatureJSONReader(String location)
location
- Optional locationpublic static org.apache.sling.feature.Feature read(Reader reader, String location) throws IOException
reader
- The reader for the featurelocation
- Optional locationIOException
- If an IO errors occurs or the JSON is invalid.protected org.apache.sling.feature.Feature readFeature(Reader reader) throws IOException
reader
- The readerIOException
- If an IO error occurs or the JSON is not valid.protected org.apache.sling.feature.ArtifactId getFeatureId(Map<String,Object> map) throws IOException
IOException
protected String minify(Reader reader) throws IOException
IOException
protected Map<String,Object> getJsonMap(javax.json.JsonObject json)
json
- The JSON object to processprotected String getProperty(Map<String,Object> map, String key) throws IOException
IOException
protected Map<String,String> readVariables(Map<String,Object> map, Map<String,String> kvMap) throws IOException
map
- The map describing the feature or applicationkvMap
- The variables will be written to this Key Value MapIOException
- If the json is invalid.protected void readBundles(Map<String,Object> map, org.apache.sling.feature.Bundles container, org.apache.sling.feature.Configurations configContainer) throws IOException
map
- The map describing the featurecontainer
- The bundles containerconfigContainer
- The configurations containerIOException
- If the json is invalid.protected void readArtifacts(String section, String artifactType, List<org.apache.sling.feature.Artifact> artifacts, Object listObj, org.apache.sling.feature.Configurations container) throws IOException
IOException
protected void addConfigurations(Map<String,Object> map, org.apache.sling.feature.Artifact artifact, org.apache.sling.feature.Configurations container) throws IOException
IOException
protected void readConfigurations(Map<String,Object> map, org.apache.sling.feature.Configurations container) throws IOException
IOException
protected void readFrameworkProperties(Map<String,Object> map, Map<String,String> container) throws IOException
IOException
protected void readExtensions(Map<String,Object> map, List<String> keywords, org.apache.sling.feature.Extensions container, org.apache.sling.feature.Configurations configContainer) throws IOException
IOException
protected void checkType(String key, Object val, Class<?>... types) throws IOException
key
- A key for the error messageval
- The value to checktypes
- The allowed types, can also include null
if null is an allowed value.IOException
- If the val is not of the specified typesprotected org.apache.sling.feature.Prototype readPrototype(Map<String,Object> map) throws IOException
IOException
protected void readRequirements(Map<String,Object> map, List<org.apache.sling.feature.MatchingRequirement> container) throws IOException
IOException
protected void readCapabilities(Map<String,Object> map, List<org.osgi.resource.Capability> container) throws IOException
IOException
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.