in src/main/java/org/apache/sling/feature/cpconverter/handlers/IndexDefinitionsEntryHandler.java [101:146]
public void handle(@NotNull String path, @NotNull Archive archive, @NotNull Entry entry,
@NotNull ContentPackage2FeatureModelConverter converter, String runMode) throws IOException, ConverterException {
IndexManager indexManager = converter.getIndexManager();
if ( indexManager == null ) {
logger.info("{} not present, will skip index definition extraction", IndexManager.class.getName());
} else {
try (InputStream is = archive.openInputStream(entry)) {
String platformPath = path.replaceAll("^/jcr_root", "")
.replaceAll("/\\.content\\.xml$", "")
.replace(".dir", "");
String repositoryPath = PlatformNameFormat.getRepositoryPath(platformPath);
InputSource inputSource = new InputSource(is);
boolean isDocView = false;
// DocViewParser.isDocView closes the input stream it is passed
try ( InputStream isCheck = archive.openInputStream(entry) ) {
isDocView = DocViewParser.isDocView(new InputSource(isCheck));
}
if ( isDocView ) {
DocViewParser parser = new DocViewParser(new SimpleNamespaceResolver());
// SLING-12469 - support index definitions serialized as full coverage aggregates
if (isOakIndexDefinitionAsFullCoverageAggregate(repositoryPath, archive, entry)) {
repositoryPath = removeXmlExtension(repositoryPath);
}
IndexDefinitionsParserHandler handler = new IndexDefinitionsParserHandler(archive.getMetaInf().getFilter(), indexManager.getIndexes());
parser.parse(repositoryPath, inputSource, handler);
} else {
// binary file, should we attach?
if ( archive.getMetaInf().getFilter().contains(repositoryPath)) {
indexManager.getIndexes().registerBinary(repositoryPath, is);
}
}
} catch (XmlParseException e) {
throw new ConverterException("Failed parsing the index definitions", e);
}
}
converter.getMainPackageAssembler().addEntry(path, archive, entry);
}