in src/main/java/org/apache/sling/feature/io/json/FeatureJSONReader.java [181:223]
private void readArtifacts(final String section,
final String artifactType,
final List<Artifact> artifacts,
final JsonValue listObj,
final Configurations container)
throws IOException {
for(final JsonValue entry : checkTypeArray(section, listObj)) {
final Artifact artifact;
checkTypeObjectOrString(artifactType, entry);
if ( entry.getValueType() == ValueType.STRING ) {
// skip comments
if ( ((JsonString)entry).getString().startsWith("#") ) {
continue;
}
artifact = new Artifact(checkTypeArtifactId(artifactType, entry));
} else {
final JsonObject bundleObj = (JsonObject) entry;
if ( !bundleObj.containsKey(JSONConstants.ARTIFACT_ID) ) {
throw new IOException(exceptionPrefix.concat(" ").concat(artifactType).concat(" is missing required artifact id"));
}
final ArtifactId id = checkTypeArtifactId(artifactType.concat(" ").concat(JSONConstants.ARTIFACT_ID), bundleObj.get(JSONConstants.ARTIFACT_ID));
artifact = new Artifact(id);
for(final Map.Entry<String, JsonValue> metadataEntry : bundleObj.entrySet()) {
final String key = metadataEntry.getKey();
// skip comments
if ( key.startsWith("#") ) {
continue;
}
if ( JSONConstants.ARTIFACT_KNOWN_PROPERTIES.contains(key) ) {
continue;
}
final String mval = checkScalarType(artifactType.concat(" metadata ").concat(key), metadataEntry.getValue(), false);
artifact.getMetadata().put(key, mval);
}
if ( bundleObj.containsKey(JSONConstants.FEATURE_CONFIGURATIONS) ) {
final JsonObject cfgs = checkTypeObject(artifactType.concat(" configurations"), bundleObj.get(JSONConstants.FEATURE_CONFIGURATIONS));
addConfigurations(cfgs, artifact, container);
}
}
artifacts.add(artifact);
}
}